public PartialViewResult EditPersonal() { PersonalInput Personal = new PersonalInput(this.Account.RID, this.Account.FirstName, this.Account.LastName, this.Account.Gender, this.Account.User.UserName); ViewBag.Gender = new SelectList(db.Genders.ToList(), "RID", "Title", Account.Gender); return(PartialView("_EditPersonal", Personal)); }
public PartialViewResult EditPersonalConfirmed(PersonalInput model) { if (ModelState.IsValid) { this.Account.User.UserName = model.UserName; this.Account.FirstName = model.FirstName; this.Account.LastName = model.LastName; this.Account.Gender = db.Genders.First(c => c.RID == model.GenderID); db.Entry(Account).State = EntityState.Modified; db.SaveChanges(); FormsAuthentication.SetAuthCookie(this.Account.User.UserName, true); return(PartialView("_Personal", Account)); } else { ModelState.AddModelError("CreateAddressFailure", "There were errors with the Address."); Response.StatusCode = 400; Response.StatusDescription = "<h4>There were errors:</h4><p>One or more of the fields could not be saved. Please review the form and ensure everything is valid.</p>"; return(PartialView("_Personal", Account)); } }