// GET: Dish/Delete/5
 public ActionResult Delete(int id)
 {
     try
     {
         var image = _dishService.GetById(id);
         _imageService.DeleteImage(image.Image);
         _dishService.DeleteById(id);
         return(RedirectToAction(nameof(Index)));
     }catch (Exception e)
     {
         return(Ok(e.Message));
     }
 }
 public IActionResult Delete(int id)
 {
     try
     {
         var image = _dishService.GetById(id);
         _imageService.DeleteImage(image.Image);
         _dishService.DeleteById(id);
         return(Ok("Succefully deleted"));
     }
     catch (Exception e)
     {
         return(BadRequest("Something went wrong"));
     }
 }
Exemplo n.º 3
0
 public void DeleteDish(string id)
 {
     service.DeleteById(id);
 }