public PartialViewResult Filter(ProductFiltersViewModel model) { ClearHttp(); HttpContext.Session.SetOrUpdate <ProductFiltersViewModel>("ProductFilters", model); var result = CategoryProductLogic.GetProductsWithFilters(model, 0, Qty, model.inputSearch); return(PartialView("ProductCard", result.GetModel)); }
public PartialViewResult GetMore(string category, int offset, string inputSearch) { ProductLogic.ModelOrError <OutputModelsForCategoryProduct.CategoryProductsModel> model; ProductFiltersViewModel filters = new ProductFiltersViewModel { Category = category, inputSearch = inputSearch }; if (HttpContext.Session.Keys.Contains("ProductFilters")) { filters = HttpContext.Session.Get <ProductFiltersViewModel>("ProductFilters"); } model = CategoryProductLogic.GetProductsWithFilters(filters, offset, Qty, inputSearch); if (model.GetModel != null) { return(PartialView("ProductCard", model.GetModel)); } return(null); }
public IActionResult CategoryProducts(string category) { ClearHttp(); var filters = new ProductFiltersViewModel(); filters.Category = category; string inputString = Request.Query.FirstOrDefault(p => p.Key == "inputSearch").Value; filters.inputSearch = inputString; var model = CategoryProductLogic.GetProductsWithFilters(filters, 0, Qty, inputString); if (model.GetModel != null) { return(View(model.GetModel)); } TempData.AddOrUpdate("Error", model.GetErrorMessage); return(Redirect(Request.Headers["Referer"].ToString())); }