diff --git a/fundamentals/minimal-apis/samples/arg-lists/Program.cs b/fundamentals/minimal-apis/samples/arg-lists/Program.cs index aba8889..5e3fd13 100644 --- a/fundamentals/minimal-apis/samples/arg-lists/Program.cs +++ b/fundamentals/minimal-apis/samples/arg-lists/Program.cs @@ -11,7 +11,8 @@ app.MapGet("/todoitems", async (TodoDb db) => await db.Todos.Select(x => new TodoItemDTO(x)).ToListAsync()); // -app.MapGet("/todoitems/{id}", async (int Id, TodoDb Db) => +app.MapGet("/todoitems/{id}", + async (int Id, TodoDb Db) => await Db.Todos.FindAsync(Id) is Todo todo ? Results.Ok(new TodoItemDTO(todo)) @@ -68,7 +69,8 @@ app.MapDelete("/todoitems/{id}", async (int Id, TodoDb Db) => // --- [AsParameters] go here ---------------------- // -app.MapGet("/ap/todoitems/{id}", async ([AsParameters] TodoItemRequest request) => +app.MapGet("/ap/todoitems/{id}", + async ([AsParameters] TodoItemRequest request) => await request.Db.Todos.FindAsync(request.Id) is Todo todo ? Results.Ok(new TodoItemDTO(todo))