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); }
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); }