joaopaulofcc

Untitled

Nov 17th, 2021
661
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.32 KB | None | 0 0
  1. using MiniTodo.Data;
  2.  
  3. var builder = WebApplication.CreateBuilder(args);
  4. builder.Services.AddDbContext<AppDbContext>();
  5.  
  6. var app = builder.Build();
  7.  
  8. app.MapGet("/v1/todos", (AppDbContext context) =>
  9. {
  10.     var todos = context.Todos;
  11.     return todos is not null ? Results.Ok(todos) : Results.NotFound();
  12. });
  13.  
  14. app.Run();
Advertisement
Add Comment
Please, Sign In to add comment