Exemple #1
0
        public ActionResult Products(bool isLatest, int?categoryId = 0)
        {
            ProductsWidgetViewModel model = new ProductsWidgetViewModel();

            model.IsLatest = isLatest;

            if (isLatest)
            {
                model.Products = widgetService.GetLatestProducts(4);
            }

            else if (categoryId.HasValue && categoryId.Value > 0)
            {
                model.Products = widgetService.GetProductsByCategory(categoryId.Value, 4);
            }
            else
            {
                model.Products = widgetService.GetAllProducts(1, 8);
            }

            return(PartialView(model));
        }