// GET: Warranty public ActionResult Search(string assetSearch, int page = 1) { int pageSize = int.Parse(ConfigHelper.GetKey("PageSize")); int totalRow = 0; var warrantiesModel = _warrantyService.Search(assetSearch, out totalRow, page, pageSize, new string[] { "Asset" }); int totalPage = (int)Math.Ceiling((double)totalRow / pageSize); var warrantyViewModel = Mapper.Map <IEnumerable <Warranty>, IEnumerable <WarrantyViewModel> >(warrantiesModel); var paginationSet = new PaginationSet <WarrantyViewModel>() { Items = warrantyViewModel, MaxPage = int.Parse(ConfigHelper.GetKey("MaxSize")), Page = page, TotalCount = totalRow, TotalPages = totalPage }; ViewBag.assetSearch = assetSearch; ViewBag.query = new { assetSearch = assetSearch, page = page }; return(View("Index", paginationSet)); }