public ActionResult Index(int?page, DateTime?startDate, DateTime?expireDate, string level) { var logSearchVM = new LogSearchVM() { StartDate = startDate, ExpireDate = expireDate, Level = level, PageIndex = (page ?? 1), PageSize = SettingsManager.Log.PageSize }; int totalCount; var logs = _logServices.SearchLogs(logSearchVM.PageIndex - 1, logSearchVM.PageSize, startDate, expireDate, level, out totalCount); logSearchVM.TotalUserCount = totalCount; logSearchVM.Logs = _mapper.Map <IEnumerable <LogVM> >(logs); var logsAsIPagedList = new StaticPagedList <LogVM>(logSearchVM.Logs, logSearchVM.PageIndex, logSearchVM.PageSize, logSearchVM.TotalUserCount); ViewBag.OnePageOfLogs = logsAsIPagedList; return(View(logSearchVM)); }