public ActionResult Create(Person person) { if (ModelState.IsValid) { person.Password = EncryptionUtilities.CreatePasswordSalt(person.Password); db.People.Add(person); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(person)); }
public ActionResult Edit(Person person) { if (ModelState.IsValid) { //if(person.SaltHash.Length.Equals(0)) // person.SaltHash = GenerateSaltValue(); person.Password = EncryptionUtilities.CreatePasswordSalt(person.Password); db.Entry(person).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(person)); }