From 32d6f1a95f7d4c514622a45081382ee7d981f3cb Mon Sep 17 00:00:00 2001 From: Izzat Alsharif Date: Sat, 6 Jul 2024 01:38:07 +0300 Subject: [PATCH] Add endpoints --- .../Controllers/ReservationController.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/RestaurantReservation.Api/Controllers/ReservationController.cs b/RestaurantReservation.Api/Controllers/ReservationController.cs index 7160fae..077bd1f 100644 --- a/RestaurantReservation.Api/Controllers/ReservationController.cs +++ b/RestaurantReservation.Api/Controllers/ReservationController.cs @@ -98,4 +98,28 @@ public async Task> GetReservationDetail(int r return Ok(result.GetDataOrThrow()); } + + [HttpGet("{reservationId:int}/orders")] + public async Task> GetFullOrders(int reservationId) + { + var result = await _reservationService.ListOrdersAndMenuItemsAsync(reservationId); + if (!result.IsSuccess) + { + return NotFound(result.ErrorMessage); + } + + return Ok(result.GetDataOrThrow()); + } + + [HttpGet("{reservationId:int}/menu-items")] + public async Task> GetOrderedMenuItems(int reservationId) + { + var result = await _reservationService.ListOrderedMenuItemsAsync(reservationId); + if (!result.IsSuccess) + { + return NotFound(result.ErrorMessage); + } + + return Ok(result.GetDataOrThrow()); + } } \ No newline at end of file