public IActionResult GetProducts([FromBody] ProductSearchRequest jsonProductSearchRequest) { GetProductsByCategoryRequest productSearchRequest = GenerateProductSearchRequestFrom(jsonProductSearchRequest); GetProductsByCategoryResponse response = _cachedProductCatalogService.GetProductsByCategory(productSearchRequest); ProductSearchResultView productSearchResultView = GetProductSearchResultViewFrom(response); return(Ok(productSearchResultView)); }
public IActionResult GetProductsByCategory(int categoryId) { GetProductsByCategoryRequest productSearchRequest = GenerateInitialProductSearchRequestFrom(categoryId); GetProductsByCategoryResponse response = _cachedProductCatalogService.GetProductsByCategory(productSearchRequest); ProductSearchResultView productSearchResultView = GetProductSearchResultViewFrom(response); return(View("ProductSearchResults", productSearchResultView)); }
public ProductSearchResultView GetProductsByCategory(int categoryId) { System.Web.Mvc.ViewResult viewResult = (System.Web.Mvc.ViewResult) this.productController.GetProductsByCategory(categoryId); ProductSearchResultView productSearchResultView = (ProductSearchResultView)viewResult.ViewData.Model; return(productSearchResultView); }
public JsonResult GetProductsByAjax(JsonProductSearchRequest jsonProductSearchRequest) { GetProductsByCategoryRequest productSearchRequest = GenerateProductSearchRequestFrom(jsonProductSearchRequest); GetProductsByCategoryResponse response = _productService.GetProductsByCategory(productSearchRequest); ProductSearchResultView productSearchResultView = GetProductSearchResultViewFrom(response); return(Json(productSearchResultView)); }
private ProductSearchResultView GetProductResultViewFrom(GetProductsByCategoryResponse response) { var result = new ProductSearchResultView(); result.CurrentPage = response.CurrentPage; result.NumberOfTitlesFound = response.NumberOfTitlesFound; result.Products = response.Products; result.RefinementGroups = response.RefinementGroups; result.SelectedCategory = response.SelectedCategory; result.SelectedCategoryName = response.SelectedCategoryName; result.TotalNumberOfPages = response.TotalNumberOfPages; return(result); }
private ProductSearchResultView GetProductSearchResultViewFrom(GetProductsByCategoryResponse response) { ProductSearchResultView productSearchResultView = new ProductSearchResultView(); productSearchResultView.BasketSummary = base.GetBasketSummaryView(); productSearchResultView.Categories = base.GetCategories(); productSearchResultView.CurrentPage = response.CurrentPage; productSearchResultView.NumberOfTitlesFound = response.NumberOfTitlesFound; productSearchResultView.Products = response.Products; productSearchResultView.RefinementGroups = response.RefinementGroups; productSearchResultView.SelectedCategory = response.SelectedCategory; productSearchResultView.SelectedCategoryName = response.SelectedCategoryName; productSearchResultView.TotalNumberOfPages = response.TotalNumberOfPages; return(productSearchResultView); }
private ProductSearchResultView GetProductSearchResultViewFrom(GetProductByCategoryResponse response) { ProductSearchResultView productSearchResultView = new ProductSearchResultView(); productSearchResultView.Categories = base.GetAllCategoriesHavingAccess(1); productSearchResultView.CurrentPage = response.CurrentPage; productSearchResultView.NumberOfProductsFound = response.NumberOfProductsFound; productSearchResultView.Products = response.Products; productSearchResultView.RefinementGroups = response.RefinementGroups; productSearchResultView.SelectedCategory = response.SelectedCategory; productSearchResultView.SelectedCategoryName = response.SelectedCategoryName; productSearchResultView.TotalNoOfPages = response.TotalNumberOfPages; productSearchResultView.RetailerId = 1; return(productSearchResultView); }