public ActionResult Index(Pages.ProductListing currentPage, string brand, string category, double price = 0, bool isSortDes = false, int pageNumber = 1)
        {
            var products = _productListingService.GetListProduct(brand, (decimal)price, category, isSortDes, pageNumber);

            currentPage.Products       = products != null && products.Products != null? products.Products :new List <ProductTileViewModel>();
            currentPage.FilterParams   = _productListingService.GetFilterParams(currentPage);
            currentPage.SelectedParams = new FilterParam()
            {
                Brand    = brand,
                Category = category,
                Price    = price
            };
            return(View(currentPage));
        }
Esempio n. 2
0
 public IHttpActionResult GetProductList(string brand, string category, decimal price = 0, bool isSortDes = false, int pageNumber = 1)
 {
     try
     {
         var productlist  = _productListingService.GetListProduct(brand, price, category, isSortDes, pageNumber);
         var viewrenderer = new ViewRenderer();
         var html         = viewrenderer.RenderPartialViewToString("~/Views/Shared/_ProductList.cshtml", productlist.Products);
         var response     = new ProductListResponse()
         {
             Html    = html,
             HasMore = (pageNumber * productlist.PageSize) < productlist.TotalProducts
         };
         return(Ok(response));
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }