Example #1
0
        public ActionResult Create([Bind(Include = "ProductID,ColorID,SizeID,Quantity")] StockViewModel stock, HttpPostedFileBase[] files)
        {
            if (ModelState.IsValid)
            {
                rep.CreateStock(stock, files);
                Session["ListProducts"] = repo.GetProducts();
                return(RedirectToAction("Index"));
            }

            ViewBag.ColorID   = new SelectList(rep.db.Colors, "ColorID", "ColorName", stock.ColorID);
            ViewBag.ProductID = new SelectList(rep.db.Products, "ProductID", "ProductName", stock.ProductID);
            ViewBag.SizeID    = new SelectList(rep.db.Sizes, "SizeID", "SizeID", stock.SizeID);
            return(View(stock));
        }
Example #2
0
        public ActionResult FindBrand(string CategoryName = "ALL", string ColorName = "ALL", string OrderBy = "None")
        {
            Session["ListProducts"] ??= repo.GetProducts();
            Session["CategoryName"] = CategoryName;
            Session["ColorName"]    = ColorName;
            Session["PriceOrderBy"] = OrderBy;
            var ProductVM = repo.GetProductsSearch(CategoryName, ColorName, OrderBy, ((List <OnlineStoreProductVM>)Session["ListProducts"]).AsQueryable());

            Session["ProductModel"] = ProductVM;
            return(View(ProductVM));
        }