Merge pull request #220 from captainsafia/safia/rdg-fix

Fix failing RDG009 case
pull/221/head
Rick Anderson 2023-10-10 10:44:12 -10:00 committed by GitHub
commit 740d934799
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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; }
}