Exemple #1
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);
        }