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

            ViewBag.StockTypeId = new SelectList(db.StockTypes, "Id", "Type", status.StockTypeId);
            return View(status);
        }
Пример #2
0
 public ActionResult Edit(Status status)
 {
     if (ModelState.IsValid)
     {
         db.Entry(status).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.StockTypeId = new SelectList(db.StockTypes, "Id", "Type", status.StockTypeId);
     return View(status);
 }