Skip to content

Commit

Permalink
Add endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
izzat5233 committed Jul 5, 2024
1 parent 57e4215 commit 32d6f1a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions RestaurantReservation.Api/Controllers/ReservationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,28 @@ public async Task<ActionResult<ReservationDetailDto>> GetReservationDetail(int r

return Ok(result.GetDataOrThrow());
}

[HttpGet("{reservationId:int}/orders")]
public async Task<ActionResult<ReservationDetailDto>> 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<ActionResult<ReservationDetailDto>> GetOrderedMenuItems(int reservationId)
{
var result = await _reservationService.ListOrderedMenuItemsAsync(reservationId);
if (!result.IsSuccess)
{
return NotFound(result.ErrorMessage);
}

return Ok(result.GetDataOrThrow());
}
}

0 comments on commit 32d6f1a

Please sign in to comment.