From 83cbfdcc8a1dc53e518d7d81f542fe359d4eea47 Mon Sep 17 00:00:00 2001 From: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com> Date: Thu, 1 Sep 2022 15:24:22 -1000 Subject: [PATCH] more code formats (#31) * more code formats * more code formats --- .../minimal-apis/samples/arg-lists/Program.cs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/fundamentals/minimal-apis/samples/arg-lists/Program.cs b/fundamentals/minimal-apis/samples/arg-lists/Program.cs index 5e3fd13..ef67cf6 100644 --- a/fundamentals/minimal-apis/samples/arg-lists/Program.cs +++ b/fundamentals/minimal-apis/samples/arg-lists/Program.cs @@ -21,7 +21,7 @@ app.MapGet("/todoitems/{id}", // Remaining code removed for brevity. // -// +// app.MapPost("/todoitems", async (TodoItemDTO Dto, TodoDb Db) => { var todoItem = new Todo @@ -35,9 +35,7 @@ app.MapPost("/todoitems", async (TodoItemDTO Dto, TodoDb Db) => return Results.Created($"/todoitems/{todoItem.Id}", new TodoItemDTO(todoItem)); }); -// -// app.MapPut("/todoitems/{id}", async (int Id, TodoItemDTO Dto, TodoDb Db) => { var todo = await Db.Todos.FindAsync(Id); @@ -51,9 +49,7 @@ app.MapPut("/todoitems/{id}", async (int Id, TodoItemDTO Dto, TodoDb Db) => return Results.NoContent(); }); -// -// app.MapDelete("/todoitems/{id}", async (int Id, TodoDb Db) => { if (await Db.Todos.FindAsync(Id) is Todo todo) @@ -65,7 +61,7 @@ app.MapDelete("/todoitems/{id}", async (int Id, TodoDb Db) => return Results.NotFound(); }); -// +// // --- [AsParameters] go here ---------------------- // @@ -77,7 +73,7 @@ app.MapGet("/ap/todoitems/{id}", : Results.NotFound()); // -// +// app.MapPost("/ap/todoitems", async ([AsParameters] CreateTodoItemRequest request) => { var todoItem = new Todo @@ -91,9 +87,7 @@ app.MapPost("/ap/todoitems", async ([AsParameters] CreateTodoItemRequest request return Results.Created($"/todoitems/{todoItem.Id}", new TodoItemDTO(todoItem)); }); -// -// app.MapPut("/ap/todoitems/{id}", async ([AsParameters] EditTodoItemRequest request) => { var todo = await request.Db.Todos.FindAsync(request.Id); @@ -107,9 +101,7 @@ app.MapPut("/ap/todoitems/{id}", async ([AsParameters] EditTodoItemRequest reque return Results.NoContent(); }); -// -// app.MapDelete("/ap/todoitems/{id}", async ([AsParameters] TodoItemRequest request) => { if (await request.Db.Todos.FindAsync(request.Id) is Todo todo) @@ -121,6 +113,6 @@ app.MapDelete("/ap/todoitems/{id}", async ([AsParameters] TodoItemRequest reques return Results.NotFound(); }); -// +// app.Run();