public ActionResult Edit(User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(user); }
public ActionResult Create(User user) { if (ModelState.IsValid) { db.Users.Add(user); db.SaveChanges(); return RedirectToAction("Index"); } return View(user); }
/// <summary> /// Add a new user /// </summary> /// <param name="newUser"></param> public void Add(User newUser) { newUser.Password = HashPassword(newUser.Password); users.Add(newUser.Username, newUser); }