コード例 #1
0
 // 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));
     }
 }
コード例 #2
0
 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"));
     }
 }
コード例 #3
0
 public void DeleteDish(string id)
 {
     service.DeleteById(id);
 }