Beispiel #1
0
        // GET: Admin/Chronicle

        #region Chronicle

        public ActionResult Index(int?page, string keyword)
        {
            ChronicleListVM chronicleListVM = GetElements(page, keyword);

            ViewBag.PageSizes = new SelectList(Site.PageSizes());
            return(View(chronicleListVM));
        }
Beispiel #2
0
        private ChronicleListVM GetElements(int?page, string keyword)
        {
            var chronicleListVM = new ChronicleListVM
            {
                Keyword   = keyword,
                PageIndex = (page ?? 1) - 1,
                PageSize  = SettingsManager.Chronicle.PageSize
            };
            int totalCount;
            var chroniclelist   = _chronicleService.GetPagedElements(chronicleListVM.PageIndex, chronicleListVM.PageSize, chronicleListVM.Keyword, out totalCount);
            var chronicleVMList = _mapper.Map <List <Chronicle>, List <ChronicleVM> >(chroniclelist);

            chronicleListVM.TotalCount = totalCount;
            chronicleListVM.Chronicles = new StaticPagedList <ChronicleVM>(chronicleVMList, chronicleListVM.PageIndex + 1, chronicleListVM.PageSize, chronicleListVM.TotalCount);;
            return(chronicleListVM);
        }