// GET: Admin/DocumentCategory #region 新闻分类 public ActionResult Index(int?page, string keyword) { DocumentCategoryListVM categoryListVM = GetElements(page, keyword); ViewBag.PageSizes = new SelectList(Site.PageSizes()); return(View(categoryListVM)); }
private DocumentCategoryListVM GetElements(int?page, string keyword) { var vm = new DocumentCategoryListVM() { Keyword = keyword, PageIndex = page ?? 1, PageSize = SettingsManager.Doc.PageSize }; int totalCount; var list = _categoryServices.GetPagedElements(vm.PageIndex - 1, vm.PageSize, vm.Keyword, out totalCount); vm.TotalCount = totalCount; vm.Categories = new StaticPagedList <DocumentCategory>(list, vm.PageIndex, vm.PageSize, vm.TotalCount);; return(vm); }