public ActionResult Edit([Bind(Include = "UserKey,Username,FirstName,LastName,DisplayName,IsAccountClosed,IsLoginAllowed,RequiresPasswordReset,Age,Email,IsAccountVerified")] UserAccountInput UserAccountInput) { if (ModelState.IsValid) { Memom.Entities.Models.UserAccount UserAccount = UserAccountConvert(UserAccountInput); UserAccount.LastUpdated = DateTime.Now; try { this.userSvc.Update(UserAccount); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(View(UserAccountInput)); } return(RedirectToAction("Index")); } return(View(UserAccountInput)); }
private UserAccountInput UserAccountConvert(Memom.Entities.Models.UserAccount UserAccount) { UserAccountInput UserAccountInput = new UserAccountInput(); if (UserAccount != null) { UserAccountInput.UserKey = UserAccount.Key; //.ToString(); UserAccountInput.Username = UserAccount.Username; UserAccountInput.FirstName = UserAccount.FirstName; UserAccountInput.LastName = UserAccount.LastName; UserAccountInput.DisplayName = UserAccount.DisplayName; UserAccountInput.Age = UserAccount.Age; UserAccountInput.IsAccountClosed = UserAccount.IsAccountClosed; UserAccountInput.IsLoginAllowed = UserAccount.IsLoginAllowed; UserAccountInput.RequiresPasswordReset = UserAccount.RequiresPasswordReset; UserAccountInput.Email = UserAccount.Email; UserAccountInput.IsAccountVerified = UserAccount.IsAccountVerified; } return(UserAccountInput); }
private Memom.Entities.Models.UserAccount UserAccountConvert(UserAccountInput UserAccountInput) { Memom.Entities.Models.UserAccount UserAccount = null; if (UserAccountInput != null) { UserAccount = this.userSvc.FindUser(UserAccountInput.UserKey); //UserAccount.Username = UserAccountInput.Username; UserAccount.FirstName = UserAccountInput.FirstName; UserAccount.LastName = UserAccountInput.LastName; UserAccount.DisplayName = UserAccountInput.DisplayName; UserAccount.Age = UserAccountInput.Age; UserAccount.IsAccountClosed = UserAccountInput.IsAccountClosed; UserAccount.IsLoginAllowed = UserAccountInput.IsLoginAllowed; UserAccount.RequiresPasswordReset = UserAccountInput.RequiresPasswordReset; //UserAccount.Email = UserAccountInput.Email; UserAccount.IsAccountVerified = UserAccountInput.IsAccountVerified; //UserAccount.LastUpdated = System.DateTime.Now; } return(UserAccount); }