Skip to content

Commit a442d80

Browse files
committed
Add usings for TypedResults and Results/NotFound/Ok etc..
1 parent 98332af commit a442d80

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/ProjectTemplates/Web.ProjectTemplates/content/WebApiAot-CSharp/Program.Main.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using System.Text.Json.Serialization;
2+
using Microsoft.AspNetCore.Http;
3+
using Microsoft.AspNetCore.Http.HttpResults;
24

35
namespace Company.WebApplication1;
46

@@ -24,7 +26,7 @@ public static void Main(string[] args)
2426
};
2527

2628
var todosApi = app.MapGroup("/todos");
27-
#if (EnableOpenAPI)
29+
#if (EnableOpenAPI)
2830
todosApi.MapGet("/", () => sampleTodos)
2931
.WithName("GetTodos");
3032

@@ -33,14 +35,14 @@ public static void Main(string[] args)
3335
? TypedResults.Ok(todo)
3436
: TypedResults.NotFound())
3537
.WithName("GetTodoById");
36-
#else
38+
#else
3739
todosApi.MapGet("/", () => sampleTodos);
3840

3941
todosApi.MapGet("/{id}", Results<Ok<Todo>, NotFound> (int id) =>
4042
sampleTodos.FirstOrDefault(a => a.Id == id) is { } todo
4143
? TypedResults.Ok(todo)
4244
: TypedResults.NotFound());
43-
#endif
45+
#endif
4446

4547
app.Run();
4648
}

src/ProjectTemplates/Web.ProjectTemplates/content/WebApiAot-CSharp/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using System.Text.Json.Serialization;
2+
using Microsoft.AspNetCore.Http;
3+
using Microsoft.AspNetCore.Http.HttpResults;
24

35
var builder = WebApplication.CreateSlimBuilder(args);
46

0 commit comments

Comments
 (0)