public ActionResult List() { ListViewModel model = new ListViewModel(); model.Filter = new ListFilterViewModel(); model.CurrentPage = 1; model.PageSize = 10; HospitalSearchFilter searchFilter = new HospitalSearchFilter(); searchFilter.CurrentPage = model.CurrentPage.HasValue ? model.CurrentPage.Value : 1; searchFilter.PageSize = model.PageSize.HasValue ? model.PageSize.Value : 10; searchFilter.SortOn = model.SortOn; searchFilter.SortDirection = model.SortDirection; searchFilter.Filter_Name = model.Filter.Filter_Name; searchFilter.Filter_CityCode = model.Filter.Filter_CityCode; model.FilterCitySelectList = GetCitySelectList(); try { model.DataList = _hospitalService.GetAllPaginatedWithDetailBySearchFilter(searchFilter); } catch { model.DataList = new PaginatedList <HospitalWithDetail>(new List <HospitalWithDetail>(), 0, searchFilter.CurrentPage, searchFilter.PageSize, searchFilter.SortOn, searchFilter.SortDirection); ViewBag.ErrorMessage = "Error"; } return(View(model)); }