Exemplo n.º 1
0
        //
        // POST: /Cart/Add
        public ActionResult Add(Product product)
        {
            if (product == null)
            {
               return HttpNotFound();
            }

            OrderLine ol = new OrderLine();

            ol.ProductID = product.ProductID;

            return PartialView(ol);
        }
Exemplo n.º 2
0
        public ActionResult Create(Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.CategoryID = new SelectList(db.Categories, "CategoryID", "Name", product.CategoryID);
            ViewBag.SupplierID = new SelectList(db.Suppliers, "SupplierID", "Name", product.SupplierID);
            return View(product);
        }
Exemplo n.º 3
0
 public ActionResult Edit(Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.CategoryID = new SelectList(db.Categories, "CategoryID", "Name", product.CategoryID);
     ViewBag.SupplierID = new SelectList(db.Suppliers, "SupplierID", "Name", product.SupplierID);
     return View(product);
 }