public ActionResult Search(string campusSearch, int page = 1) { int pageSize = int.Parse(ConfigHelper.GetKey("PageSize")); int totalRow = 0; var campusModel = _campusService.Search(campusSearch, 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("PageSize")), Page = page, TotalCount = totalRow, TotalPages = totalPage }; ViewBag.campusSearch = campusSearch; ViewBag.query = new { campusSearch = campusSearch, page = page }; return(View("Index", paginationSet)); }