File tree Expand file tree Collapse file tree 1 file changed +18
-15
lines changed Expand file tree Collapse file tree 1 file changed +18
-15
lines changed Original file line number Diff line number Diff line change 56
56
. WithOpenApi ( ) ;
57
57
58
58
app . MapGet ( "/Hotels" , async ( ) =>
59
- {
60
- throw new NotImplementedException ( ) ;
61
- } )
62
- . WithName ( "GetHotels" )
63
- . WithOpenApi ( ) ;
59
+ {
60
+ var hotels = await app . Services . GetRequiredService < IDatabaseService > ( ) . GetHotels ( ) ;
61
+ return hotels ;
62
+ } )
63
+ . WithName ( "GetHotels" )
64
+ . WithOpenApi ( ) ;
64
65
65
66
app . MapGet ( "/Hotels/{hotelId}/Bookings/" , async ( int hotelId ) =>
66
- {
67
- throw new NotImplementedException ( ) ;
68
- } )
69
- . WithName ( "GetBookingsForHotel" )
70
- . WithOpenApi ( ) ;
67
+ {
68
+ var bookings = await app . Services . GetRequiredService < IDatabaseService > ( ) . GetBookingsForHotel ( hotelId ) ;
69
+ return bookings ;
70
+ } )
71
+ . WithName ( "GetBookingsForHotel" )
72
+ . WithOpenApi ( ) ;
71
73
72
74
app . MapGet ( "/Hotels/{hotelId}/Bookings/{min_date}" , async ( int hotelId , DateTime min_date ) =>
73
- {
74
- throw new NotImplementedException ( ) ;
75
- } )
76
- . WithName ( "GetRecentBookingsForHotel" )
77
- . WithOpenApi ( ) ;
75
+ {
76
+ var bookings = await app . Services . GetRequiredService < IDatabaseService > ( ) . GetBookingsByHotelAndMinimumDate ( hotelId , min_date ) ;
77
+ return bookings ;
78
+ } )
79
+ . WithName ( "GetRecentBookingsForHotel" )
80
+ . WithOpenApi ( ) ;
78
81
79
82
app . MapPost ( "/Chat" , async Task < string > ( HttpRequest request ) =>
80
83
{
You can’t perform that action at this time.
0 commit comments