コード例 #1
0
 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());
 }
コード例 #2
0
        public ActionResult Index()
        {
            var nccTranslator = new NccTranslator(CurrentLanguage);

            ViewBag.TotalUser = _userManager.Users.Count();

            ViewBag.TotalPublishedPage = _pageService.LoadAllByPageStatus(NccPage.NccPageStatus.Published).Count();
            ViewBag.TotalPage          = _pageService.LoadAll(true).Count();


            ViewBag.TotalCategory      = _categoryService.LoadAll(true).Count();
            ViewBag.TotalTag           = _tagService.LoadAll(true).Count();
            ViewBag.TotalPublishedPost = _postService.Count(true, true, true, true);
            ViewBag.TotalPost          = _postService.LoadAll(true).Count();
            ViewBag.TotalComments      = _commentsService.LoadAll(true).Count();

            return(View());
        }
コード例 #3
0
        public ActionResult Index()
        {
            var webSite  = new NccWebSite();
            var webSites = _webSiteService.LoadAll();

            if (webSites != null && webSites.Count > 0)
            {
                webSite = webSites.FirstOrDefault();
            }
            ViewBag.TotalPublishedPage = _pageService.LoadAllByPageStatus(NccPage.NccPageStatus.Published).Count();
            ViewBag.TotalPage          = _pageService.LoadAll(true).Count();
            ViewBag.TotalPublishedPost = _postService.Count(true, true, true, true);
            ViewBag.TotalPost          = _postService.LoadAll(true).Count();
            ViewBag.TotalUser          = _userManager.Users.Count();
            ViewBag.TotalModule        = _moduleService.LoadAll().Count();
            ViewBag.TotalTheme         = GlobalContext.Themes.Count();
            return(View(webSite));
        }
コード例 #4
0
        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 }));
        }