public ActionResult Create(User user) { if (ModelState.IsValid) { db.Users.Add(user); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.PositionID = new SelectList(db.Positions, "PositionID", "PositionName", user.PositionID); return View(user); }
public ActionResult Edit(User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.PositionID = new SelectList(db.Positions, "PositionID", "PositionName", user.PositionID); return View(user); }