public ActionResult Index(string search, int?page) { HomeModel hm = new HomeModel(); if (string.IsNullOrWhiteSpace(search)) { hm.ItemsVM = _storeMapper.SortByPriceDES().ToPagedList(page ?? 1, ITEMS_PER_PAGE); return(View(hm)); } ICollection <ItemVM> items = _itemMapper.Search(_searchItem.StoreName, _searchItem.Model, _searchItem.Brand, _searchItem.Sex, _searchItem.MinPrice, _searchItem.MaxPrice, _searchItem.Size); hm.ItemsVM = items.ToPagedList(page ?? 1, ITEMS_PER_PAGE); return(View("Index", hm)); }