Merge pull request #141 from dotnet/addSnippets

add snippet tags
pull/143/head
Rick Anderson 2023-04-10 16:23:27 -10:00 committed by GitHub
commit c2a07364c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -26,6 +26,7 @@ public class TodoInMemoryTests
}
// </snippet_>
// <snippet_11>
[Fact]
public async Task GetAllReturnsTodosFromDatabase()
{
@ -72,6 +73,7 @@ public class TodoInMemoryTests
Assert.True(todo2.IsDone);
});
}
// </snippet_11>
// <snippet_1>
[Fact]

View File

@ -32,11 +32,13 @@ public static class TodoEndpointsV1
}
// get all todos
// <snippet_1>
public static async Task<IResult> GetAllTodos(TodoGroupDbContext database)
{
var todos = await database.Todos.ToListAsync();
return TypedResults.Ok(todos);
}
// </snippet_1>
// get todo by id
public static async Task<Results<Ok<Todo>, NotFound>> GetTodo(int id, TodoGroupDbContext database)