public IActionResult Delete(int id) { if (_repository.GetDishById(id) == null) { return(NotFound()); } _repository.DeleteDish(id); return(NoContent()); }
public ActionResult Delete(int dishId) { Dish dish = repository.DeleteDish(dishId); if (dish != null) { TempData["message"] = string.Format("Editing in dish \"{0}\" was deleted", dish.Name); } return(RedirectToAction("DishesSummary")); }
public IActionResult Delete(int dishId) { Dish deletedDish = repository.DeleteDish(dishId); if (deletedDish != null) { TempData["message"] = $"{deletedDish.Name} was deleted"; } return(RedirectToAction("Index")); }
/// <summary> /// Method removes dish /// </summary> /// <param name="dishId">Id of user to delete</param> public void DeleteDish(int dishId) { try { _dishRepository.DeleteDish(dishId); } catch (Exception ex) { throw new Exception("Error while deleting dish: " + ex.Message, ex); } }