From bef98a31c8364680e8b52fd3bc605fe642c836d3 Mon Sep 17 00:00:00 2001 From: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com> Date: Thu, 1 Sep 2022 15:11:22 -1000 Subject: [PATCH] format sample (#30) --- fundamentals/minimal-apis/samples/arg-lists/Program.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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))