예제 #1
0
 public ActionResult Edit(Unit unit)
 {
     if (ModelState.IsValid)
     {
         db.Entry(unit).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(unit);
 }
예제 #2
0
        public ActionResult Create(Unit unit)
        {
            if (ModelState.IsValid)
            {
                db.Units.Add(unit);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(unit);
        }