Esempio n. 1
0
        public ActionResult CreateProduct(BusinessEntities.DropDownList ProductCategories, string Name, double MinQuantity, string BtnSubmit)
        {
            BusinessEntities.Product p = new BusinessEntities.Product(Name, ProductCategories.SelectedItemId, MinQuantity);
            BusinessLayer.ProductBusinessLayer l = new BusinessLayer.ProductBusinessLayer();
            l.CreateProduct(p);

            return RedirectToAction("Index");
        }
Esempio n. 2
0
        // GET: Products
        public ActionResult Index()
        {
            Models.ProductsModel m = new Models.ProductsModel();
            BusinessLayer.ProductBusinessLayer lp = new BusinessLayer.ProductBusinessLayer();
            m.Products = lp.GetProducts();

            m.ProductCategories = new BusinessEntities.DropDownList();
            BusinessLayer.ProductCategoryLayer lc = new BusinessLayer.ProductCategoryLayer();
            m.ProductCategories.Categories = lc.GetProductCategories();
            m.ProductCategories.Items = m.ProductCategories.Categories.Select(x => new SelectListItem { Value = x.ProductCategoryId.ToString(), Text = x.Name }) ;

            m.ProductCategories.SelectedItemId = 0;

            m.ShoppingListModel = base.GetShoppingListModel();

            return View(m);
        }