Пример #1
0
        public IActionResult Index(int pageId = 1, int take = 0, string filter = "", List <int> selectedCategory = null)
        {
            ViewBag.Categors = _itemp.GetAllCategory();
            ViewBag.PageId   = pageId;
            //--------------------------
            ViewBag.SelectedCategory = selectedCategory;

            var result = _itemp.GetProducts(pageId, 4, filter, selectedCategory);

            return(View("Index", result));
        }
Пример #2
0
        public IActionResult SearchByCategory(int id)
        {
            List <Product> products = _temp.GetProducts(id);

            Category category = _temp.GetCategory(id);

            List <Category> categories = _temp.GetCategoryById(Convert.ToInt32(category.ParentId));

            Category parentCategory = _temp.GetCategory(Convert.ToInt32(category.ParentId));

            List <Store> stores = _temp.GetStores(id);

            var viewmodel = new SearchCategoryViewModel();

            viewmodel.FillCategories     = categories;
            viewmodel.FillProducts       = products;
            viewmodel.FillParentCategory = parentCategory;
            viewmodel.FillSelectCategory = category;
            viewmodel.FillStores         = stores;

            return(View(viewmodel));
        }