public IActionResult Sort(string sortField, SortDirection sortDirection = SortDirection.Ascending) { if (!sortField.IsEmpty()) { var filter = SearchFilterHelpers.GetSearchFilter <CountryFilter>(this); filter.SortField = sortField; filter.SortDirection = sortDirection; SearchFilterHelpers.SetSearchFilter(this, filter); } return(RedirectToAction("List")); }
public IActionResult List(int page = 1) { var model = new PagedSearchResult <CountryListItem, CountryFilter>(); model.Filter = SearchFilterHelpers.GetSearchFilter <CountryFilter>(this); if (page != model.Filter.Page) { model.Filter.Page = page; SearchFilterHelpers.SetSearchFilter(this, model.Filter); } model.Results = _service.FindManyDtoPaged <CountryListItem>(model.Filter.Page, model.Filter.PageSize, model.Filter.GetSpecification(), model.Filter.GetSortSpecifications()); return(View(model)); }