// GET: Campus public ActionResult Index(int page = 1) { int pageSize = int.Parse(ConfigHelper.GetKey("PageSize")); int totalRow = 0; var campusModel = _campusService.GetAllPaging(out totalRow, page, pageSize); int totalPage = (int)Math.Ceiling((double)totalRow / pageSize); var campusViewModel = Mapper.Map <IEnumerable <Campus>, IEnumerable <CampusViewModel> >(campusModel); var paginationSet = new PaginationSet <CampusViewModel>() { Items = campusViewModel, MaxPage = int.Parse(ConfigHelper.GetKey("MaxSize")), Page = page, TotalCount = totalRow, TotalPages = totalPage }; ViewBag.query = new { page = page }; return(View(paginationSet)); }