Fix snippet syntax
parent
9c3db2662e
commit
961044d9fa
|
@ -17,17 +17,17 @@ if (app.Environment.IsDevelopment())
|
|||
|
||||
app.MapGet("/", () => "Hello World!");
|
||||
|
||||
#region snippet_grp
|
||||
// <snippet_grp>
|
||||
app.MapGet("/todoitems", async (TodoDb db) =>
|
||||
await db.Todos.ToListAsync())
|
||||
.WithTags("TodoGroup");
|
||||
#endregion
|
||||
// </snippet_grp>
|
||||
|
||||
#region snippet_name
|
||||
// <snippet_name>
|
||||
app.MapGet("/todoitems2", async (TodoDb db) =>
|
||||
await db.Todos.ToListAsync())
|
||||
.WithName("GetToDoItems");
|
||||
#endregion
|
||||
// </snippet_name>
|
||||
|
||||
app.MapGet("/todoitems/complete", async (TodoDb db) =>
|
||||
await db.Todos.Where(t => t.IsComplete).ToListAsync());
|
||||
|
@ -38,7 +38,7 @@ app.MapGet("/todoitems/{id}", async (int id, TodoDb db) =>
|
|||
? Results.Ok(todo)
|
||||
: Results.NotFound());
|
||||
|
||||
#region snippet_getCustom
|
||||
// <snippet_getCustom>
|
||||
app.MapGet("/api/todoitems/{id}", async (int id, TodoDb db) =>
|
||||
await db.Todos.FindAsync(id)
|
||||
is Todo todo
|
||||
|
@ -46,7 +46,7 @@ app.MapGet("/api/todoitems/{id}", async (int id, TodoDb db) =>
|
|||
: Results.NotFound())
|
||||
.Produces<Todo>(StatusCodes.Status200OK)
|
||||
.Produces(StatusCodes.Status404NotFound);
|
||||
#endregion
|
||||
// </snippet_getCustom>
|
||||
|
||||
app.MapGet("/api/todoitems", async (TodoDb db) =>
|
||||
await db.Todos.ToListAsync())
|
||||
|
|
Loading…
Reference in New Issue