Update Program.cs example (#24361)

Utilize Microsoft.AspNetCore.Http.StatusCodes instead of integers for Produces() method of a endpoint mapping to utilize available convention within the AspNetCore framework.
pull/24367/head
Kelby Hunt 2021-12-17 15:30:30 -08:00 committed by GitHub
parent 36f989d350
commit 849e293175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -44,8 +44,8 @@ app.MapGet("/api/todoitems/{id}", async (int id, TodoDb db) =>
is Todo todo
? Results.Ok(todo)
: Results.NotFound())
.Produces<Todo>(200)
.Produces(404);
.Produces<Todo>(StatusCodes.Status200OK)
.Produces(StatusCodes.Status404NotFound);
#endregion
app.MapGet("/api/todoitems", async (TodoDb db) =>