public ActionResult Index(bool isManage = false, long menuId = 0) { ViewBag.AllPages = _pageService.LoadAllByPageStatus(NccPage.NccPageStatus.Published); ViewBag.RecentPages = _pageService.LoadRecentPages(5); ViewBag.MenuList = _menuService.LoadAll(); ViewBag.MenuLocations = GlobalConfig.ActiveTheme.MenuLocations.ToList(); ViewBag.IsManage = false; if (isManage) { ViewBag.IsManage = true; } ViewBag.CurrentMenu = new NccMenu(); ViewBag.CurrentMenuItems = ""; if (menuId > 0) { //NccMenu nccMenu = _menuService.Get(menuId); NccMenu nccMenu = GlobalConfig.Menus.Where(x => x.Id == menuId).FirstOrDefault(); if (nccMenu != null) { ViewBag.CurrentMenu = nccMenu; string finalMenuList = ""; foreach (var menuItem in nccMenu.MenuItems.OrderBy(m => m.MenuOrder)) { finalMenuList += menuItemToString(menuItem, 1); } ViewBag.CurrentMenuItems = finalMenuList; } } return(View()); }
public ActionResult DeleteMenu(long menuId) { ViewBag.AllPages = _pageService.LoadAllByPageStatus(NccPage.NccPageStatus.Published); ViewBag.RecentPages = _pageService.LoadRecentPages(5); ViewBag.MenuList = _menuService.LoadAll(); try { _menuService.DeletePermanently(menuId); TempData["SuccessMessage"] = "Delete successful"; //return RedirectToAction("Index", new { isManage = true }); } catch (Exception ex) { //TODO: log error TempData["ErrorMessage"] = "Delete Failed"; } GlobalContext.Menus = _menuService.LoadAllSiteMenus(); return(RedirectToAction("Index", new { isManage = true })); }