public ActionResult DeleteMenuItemConfirmed(int id)
        {
            MenuItem menuItem = _menuItemService.GetMenuItem(id);

            _menuItemService.DeleteMenuItem(menuItem);
            return(RedirectToAction("Index"));
        }
示例#2
0
        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 }));
        }
示例#3
0
        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);
 }
示例#6
0
 public IActionResult Delete(long id)
 {
     menuItemService.DeleteMenuItem(id);
     menuItemService.SaveMenuItem();
     return(RedirectToAction("Index", "MenuItem"));
 }