Exemplo n.º 1
0
        public async Task <IActionResult> DeleteDish([FromRoute] int id)
        {
            var loggedUser = User.GetUserIdFromToken();
            await _dishService.DeleteDishAsync(loggedUser, id);

            return(Ok());
        }
Exemplo n.º 2
0
 public async Task <IActionResult> DeleteDishAsync(int restaurantId, int id) // you can return an IActionResult
 {
     try
     {
         return(Ok(await service.DeleteDishAsync(restaurantId, id)));
     }
     catch (NotFoundException ex)
     {
         return(NotFound(ex.Message));
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
     }
 }