public ShopViewModel GetShopViewModel(int?currentPage, string searchFilter, string searchValue, string sortOrder) { ShopViewModel result = new ShopViewModel() { brandModels = GetBrandViewModel(), categoryModels = GetCategoryViewModel(), productListModels = _productListViewService.GetProductListViewModel(currentPage, searchFilter, searchValue, sortOrder), }; return(result); }
public ActionResult ProductList(string sortOrder, int?currentPage, string currentFilter, string currentFilterValue, string searchValue, string searchFilter) { try { ViewBag.CurrentSort = sortOrder; if (searchFilter != null) { currentPage = 1; } else { searchFilter = currentFilter; searchValue = currentFilterValue; } ViewBag.CurrentFilter = searchFilter; ViewBag.CurrentFilterValue = searchValue; var model = _productListViewService.GetProductListViewModel(currentPage, searchFilter, searchValue, sortOrder); return(PartialView("/Views/Partials/ProductList.cshtml", model)); } catch { return(RedirectToAction("Erorr", "Home")); } }