Fix failing RDG009 case

pull/220/head
Safia Abdalla 2023-10-10 13:33:02 -07:00
parent c21ef5354a
commit aab1e7bf5b
1 changed files with 2 additions and 2 deletions

View File

@ -64,8 +64,7 @@ var app = builder.Build();
app.MapGet("/v1/todos/{id}", ([AsParameters] TodoItemRequest request) =>
{
return request.todos.ToList().Find(todoItem => todoItem.Id == request.Id)
is Todo todo
return request.todos.ToList().Find(todoItem => todoItem.Id == request.Id) is Todo todo
? Results.Ok(todo)
: Results.NotFound();
});
@ -75,6 +74,7 @@ app.Run();
struct TodoItemRequest
{
public int Id { get; set; }
[AsParameters]
public Todo[] todos { get; set; }
}