public ActionResult DeleteMenuItemConfirmed(int id) { MenuItem menuItem = _menuItemService.GetMenuItem(id); _menuItemService.DeleteMenuItem(menuItem); return(RedirectToAction("Index")); }
public IActionResult DeleteMenuItem(int Id) { var currentCulture = CultureInfo.CurrentCulture.Name; var menuItem = _menuItemService.GetMenuItemById(Id, currentCulture); _menuItemService.DeleteMenuItem(Id); return(RedirectToAction("MenuItems", new { Id = menuItem.MenuId })); }
public async Task <IActionResult> Delete(int id) { if (id == 0) { return(NotFound()); } var MenuItem = await menuItemService.GetMenuItemById(id); if (MenuItem.Image != null) { string webRootPath = hostEnvironment.WebRootPath; var imgPath = Path.Combine(webRootPath, MenuItem.Image.TrimStart('\\')); var imgName = imgPath.Split("MenuItem\\"); if (imgName.Length > 1) { System.IO.File.Delete(imgName[1]); } } if (await menuItemService.DeleteMenuItem(id)) { return(RedirectToAction(nameof(Index))); } return(View()); }
public async Task Delete(Guid id) { await _menuItemService.DeleteMenuItem(id); _unitOfWork.Complete(); }
public void DeleteMenuItem(MenuItem menuItem) { _menuItemService.DeleteMenuItem(menuItem); }
public IActionResult Delete(long id) { menuItemService.DeleteMenuItem(id); menuItemService.SaveMenuItem(); return(RedirectToAction("Index", "MenuItem")); }