Add new insert endpoint for Lok open hours
This commit is contained in:
@@ -2,11 +2,18 @@ public static class LokEndpoints
|
||||
{
|
||||
public static void MapLokEndpoints(WebApplication app)
|
||||
{
|
||||
app.MapPost("/lok/open-hours", async (LokOpenHours openHours, LokService lokService) =>
|
||||
{
|
||||
var createdOpenHours = await lokService.InsertOpenHours(openHours);
|
||||
return Results.Created("/lok/open-hours", createdOpenHours);
|
||||
})
|
||||
.WithName("CreateLokOpenHours");
|
||||
|
||||
app.MapGet("/lok/open-hours", async (LokService lokService) =>
|
||||
{
|
||||
var openHours = await lokService.GetOpenHoursAsync();
|
||||
var openHours = await lokService.GetOpenHours();
|
||||
|
||||
if (openHours is null)
|
||||
if (openHours.Count == 0)
|
||||
{
|
||||
return Results.NotFound(new
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user