public ActionResult Delete(int id) { _menuItemRepository.Delete(id); _menuItemRepository.Save(); return(Ok()); }
// GET: MenuItemController/Delete/5 public async Task <IActionResult> Delete(int id, MenuItemVM model) { var obj = await _repo.FindById(id); if (obj == null) { return(NotFound()); } if (obj.Image != null) { string uploadsFolder = Path.Combine(_webHostEnvironment.WebRootPath, "images"); var imagePath = Path.Combine(uploadsFolder, obj.Image); if (System.IO.File.Exists(imagePath)) { System.IO.File.Delete(imagePath); } } var success = await _repo.Delete(obj); if (!success) { return(BadRequest()); } return(RedirectToAction(nameof(Index))); }
public bool DeleteMenuItem(int id) { Condition.WithExceptionOnFailure <InvalidParameterException>() .Requires(_menuRepository, "menuItemId") .IsNotNull(); _menuItemRepository.Delete(_menuItemRepository.Get(id)); return(_menuRepository.Save()); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var menuItem = _repository.Get(id); if (menuItem == null) { return(HttpNotFound()); } if (!Request.IsAjaxRequest()) { return(RedirectToAction("Index")); } _repository.Delete(menuItem); _repository.Save(); return(Json("", JsonRequestBehavior.AllowGet)); }
public IActionResult Delete(int Id) { CommonResponse <int> response = new CommonResponse <int>(); var result = _menuItemRepository.Delete(Id, this.loginUserId); if (result == 0) { response.status = Helper.failure_code; response.message = Message.menuItemDeletedError; } else if (result == Helper.refernce_error_code) { response.message = Message.referenceError; } else { response.status = Helper.success_code; response.message = Message.menuItemDeleted; } return(Ok(response)); }
public void Delete(int itemId) { _repo.Delete(itemId); }
public bool DeleteMenuItem(MenuItemDto menuItemDto) { var entiy = _dtoMapper.Map(menuItemDto); return(_menuItemRepository.Delete(entiy)); }
public void DeleteMenuItem(long id) { menuItemRepository.Delete(x => x.Id == id); }
public void Delete(MenuItem the_item) { _menuItemRepository.Delete(the_item); }