public bool SaveUserProfile(LocalUserModel profile) { var saveSucceeded = false; try { using (var db = new Entities()) { var tmpProfile = db.UserProfiles.Single(u => u.Id == profile.Id); if (tmpProfile != null) { tmpProfile.Email = profile.Email; db.SaveChanges(); } } saveSucceeded = true; } catch (Exception ex) { Logger.ErrorFormat("SaveProfile - error [{0}] - \r\n {1} \r\n\r\n", ex.Message, ex.StackTrace); } return(saveSucceeded); }
public LocalUserModel GetUserProfileAndMapToLocalUserModel() { var userModel = new LocalUserModel(); var userProfile = GetUserProfileByName(HttpContext.Current.User.Identity.Name); if (userProfile != null) { userModel.Email = userProfile.Email; userModel.Id = userProfile.Id; } return(userModel); }
public ActionResult SaveUserProfileData(LocalUserModel model) { if (ModelState.IsValid) { if (_userRepository.SaveUserProfile(model)) { TempData["Message"] = MessageIdEnum.ChangeUserProfileDataSuccess; return(RedirectToAction("Manage")); } } TempData["Message"] = MessageIdEnum.ChangeUserProfileDataFailure; return(RedirectToAction("Manage")); }