File tree Expand file tree Collapse file tree 2 files changed +22
-16
lines changed
src/ProjectTemplates/Web.ProjectTemplates/content/WebApiAot-CSharp Expand file tree Collapse file tree 2 files changed +22
-16
lines changed Original file line number Diff line number Diff line change @@ -24,24 +24,27 @@ public static void Main(string[] args)
2424 } ;
2525
2626 var todosApi = app . MapGroup ( "/todos" ) ;
27+ #if ( EnableOpenAPI )
2728 todosApi . MapGet ( "/" , ( ) => sampleTodos )
28- #if ( EnableOpenAPI )
2929 . WithName ( "GetTodos" ) ;
30- #else
31- ;
32- #endif
30+ #else
31+ todosApi . MapGet ( "/" , ( ) => sampleTodos ) ;
32+ #endif
3333
34+ #if ( EnableOpenAPI )
3435 todosApi . MapGet ( "/{id}" , ( int id ) =>
3536 sampleTodos . FirstOrDefault ( a => a . Id == id ) is { } todo
3637 ? Results . Ok ( todo )
3738 : Results . NotFound ( ) )
38- #if ( EnableOpenAPI )
3939 . WithName ( "GetTodoById" )
4040 . Produces < Todo > ( StatusCodes . Status200OK )
4141 . Produces ( StatusCodes . Status404NotFound ) ;
42- #else
43- ;
44- #endif
42+ #else
43+ todosApi . MapGet ( "/{id}" , ( int id ) =>
44+ sampleTodos . FirstOrDefault ( a => a . Id == id ) is { } todo
45+ ? Results . Ok ( todo )
46+ : Results . NotFound ( ) ) ;
47+ #endif
4548
4649 app . Run ( ) ;
4750 }
Original file line number Diff line number Diff line change 3030} ;
3131
3232var todosApi = app . MapGroup ( "/todos" ) ;
33+ #if ( EnableOpenAPI )
3334todosApi . MapGet ( "/" , ( ) => sampleTodos )
34- #if ( EnableOpenAPI )
3535 . WithName ( "GetTodos" ) ;
36- #else
37- ;
38- #endif
36+ #else
37+ todosApi . MapGet ( "/" , ( ) => sampleTodos ) ;
38+ #endif
3939
40+ #if ( EnableOpenAPI )
4041todosApi . MapGet ( "/{id}" , ( int id ) =>
4142 sampleTodos . FirstOrDefault ( a => a . Id == id ) is { } todo
4243 ? Results . Ok ( todo )
4344 : Results . NotFound ( ) )
44- #if ( EnableOpenAPI )
4545 . WithName ( "GetTodoById" )
4646 . Produces < Todo > ( StatusCodes . Status200OK )
4747 . Produces ( StatusCodes . Status404NotFound ) ;
48- #else
49- ;
50- #endif
48+ #else
49+ todosApi . MapGet ( "/{id}" , ( int id ) =>
50+ sampleTodos . FirstOrDefault ( a => a . Id == id ) is { } todo
51+ ? Results . Ok ( todo )
52+ : Results . NotFound ( ) ) ;
53+ #endif
5154
5255app . Run ( ) ;
5356
You can’t perform that action at this time.
0 commit comments