Exemplo n.º 1
0
        public ActionResult Create(BuyPrice buyprice)
        {
            if (ModelState.IsValid)
            {
                db.BuyPrices.Add(buyprice);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.ProductId = new SelectList(db.Products, "ProductId", "Name", buyprice.ProductId);
            ViewBag.CustomerTypeId = new SelectList(db.CustomerTypes, "CustomerTypeId", "Name", buyprice.CustomerTypeId);
            ViewBag.ProductUnitId = new SelectList(db.ProductUnits, "ProductUnitId", "Name", buyprice.ProductUnitId);
            return View(buyprice);
        }
Exemplo n.º 2
0
 public ActionResult Edit(BuyPrice buyprice)
 {
     if (ModelState.IsValid)
     {
         db.Entry(buyprice).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.ProductId = new SelectList(db.Products, "ProductId", "Name", buyprice.ProductId);
     ViewBag.CustomerTypeId = new SelectList(db.CustomerTypes, "CustomerTypeId", "Name", buyprice.CustomerTypeId);
     ViewBag.ProductUnitId = new SelectList(db.ProductUnits, "ProductUnitId", "Name", buyprice.ProductUnitId);
     return View(buyprice);
 }