Пример #1
0
 public ActionResult ManageCategories([DefaultValue(1)] int page)
 {
     var allCategories = _categoryRepository.GetCategories();
     var categoryModel = new AdminCategoriesViewModel
     {
         Categories = allCategories.Skip((page - 1) * _itemsPerPage).Take(_itemsPerPage).ToList(),
         PagingInfo = new PagingInformation
         {
             CurrentPage = page,
             ItemsPerPage = _itemsPerPage,
             TotalItems = allCategories.Count
         },
         OneTimeCode = GetToken(),
         Title = SettingsRepository.BlogName
     };
     return View(categoryModel);
 }
Пример #2
0
        public ActionResult ManageCategories([DefaultValue(1)] int page)
        {
            if (!User.IsInRole("SuperAdmin") && !User.IsInRole("Admin"))
            {
                return RedirectToAction("Index", "Home", new { Area = "" });
            }

            var allCategories = _categoryRepository.GetCategories();
            var categoryModel = new AdminCategoriesViewModel
            {
                Categories = allCategories.Skip((page - 1) * _itemsPerPage).Take(_itemsPerPage).ToList(),
                PagingInfo = new PagingInformation
                {
                    CurrentPage = page,
                    ItemsPerPage = _itemsPerPage,
                    TotalItems = allCategories.Count
                },
                OneTimeCode = GetToken(),
                Title = SettingsRepository.BlogName
            };
            return View(categoryModel);
        }