private EmailListVM GetElements(int?page, string keyword, bool active) { var emailListVM = new EmailListVM(); emailListVM.Keyword = keyword; emailListVM.PageIndex = (page ?? 1); emailListVM.PageSize = SettingsManager.Email.PageSize; int totalCount; var emaillist = _emailServices.GetPagedElements(emailListVM.PageIndex - 1, emailListVM.PageSize, emailListVM.Keyword, active, out totalCount); // var emailVMList = _mapper.Map<List<Email>, List<EmailVM>>(emaillist); emailListVM.TotalCount = totalCount; emailListVM.Emails = new StaticPagedList <Email>(emaillist, emailListVM.PageIndex, emailListVM.PageSize, emailListVM.TotalCount);; return(emailListVM); }