Пример #1
0
        public ActionResult Create( Orders orders)
        {
            if (ModelState.IsValid)
            {
                db.Orders.Add(orders);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.CustomerID = new SelectList(db.Customer, "CustomerID", "FirstName", orders.CustomerID);
            return View(orders);
        }
Пример #2
0
 public ActionResult Edit(Orders orders)
 {
     if (ModelState.IsValid)
     {
         db.Entry(orders).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.CustomerID = new SelectList(db.Customer, "CustomerID", "FirstName", orders.CustomerID);
     return View(orders);
 }