// GET: Admin/FilterTemplates public ActionResult Index(int?filterTemplate, string keyword) { FilterTemplateListVM filterTemplateListVM = GetElements(filterTemplate, keyword); ViewBag.PageSizes = new SelectList(Site.PageSizes()); return(View(filterTemplateListVM)); }
private FilterTemplateListVM GetElements(int?filterTemplate, string keyword) { var filterTemplateListVM = new FilterTemplateListVM(); filterTemplateListVM.Keyword = keyword; filterTemplateListVM.PageIndex = filterTemplate ?? 1; filterTemplateListVM.PageSize = SettingsManager.FilterTemplate.PageSize; int totalCount; var filterTemplatelist = _filterTemplateService.GetPagedElements(filterTemplateListVM.PageIndex - 1, filterTemplateListVM.PageSize, filterTemplateListVM.Keyword, out totalCount); var filterTemplateVMList = _mapper.Map <List <FilterTemplate>, List <FilterTemplateVM> >(filterTemplatelist); filterTemplateListVM.TotalCount = totalCount; filterTemplateListVM.FilterTemplates = new StaticPagedList <FilterTemplateVM>(filterTemplateVMList, filterTemplateListVM.PageIndex, filterTemplateListVM.PageSize, filterTemplateListVM.TotalCount);; return(filterTemplateListVM); }