コード例 #1
0
        //-----------------------------------------------------
        //Отображение всех товаров по конкретной категории
        public ActionResult ShowProductsInCategory(int CategoryId)
        {
            TempData["CategoryName"] = repo.GetCategoryName(CategoryId);
            if (CategoryId == 1)
            {
                IQueryable <Parfum> Products = productrepo.GetProductsFromCategory(CategoryId);
                return(View(Products));
            }

            else if (CategoryId == 2)
            {
                IQueryable <Cosmetic> Cosmetics = cosmeticrepo.AdminGetProductsFromCategory(CategoryId).OrderByDescending(x => x.ProductId);
                return(View("ShowCosmeticsInCategory", Cosmetics));
            }

            else if (CategoryId == 3)
            {
                IQueryable <Care> Cares = carerepo.AdminGetProductsFromCategory(CategoryId).OrderByDescending(x => x.ProductId);
                return(View("ShowCaresInCategory", Cares));
            }

            return(View());
        }