public void UpdateProfile(string email, UserProfile userProfile) { var user = _userRepository.GetAll().QueryForUserByEmail(email); if (user == null) return; user.UserProfile.FirstName = userProfile.FirstName; user.UserProfile.LastName = userProfile.LastName; user.UserProfile.Address = userProfile.Address; user.UserProfile.City = userProfile.City; user.UserProfile.PostalCode = userProfile.PostalCode; user.UserProfile.Country = userProfile.Country; _userRepository.SaveOrUpdate(user); }
public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { var args = new ValidatePasswordEventArgs(username, password, true); OnValidatingPassword(args); if (args.Cancel) { status = MembershipCreateStatus.InvalidPassword; return null; } if (RequiresUniqueEmail && GetUserNameByEmail(email) != string.Empty) { status = MembershipCreateStatus.DuplicateEmail; return null; } var user = GetUser(email, true /* is online */); if (user == null) { var shoppingCart = new ShoppingCart(); var userProfile = new UserProfile(); var salt = CreateSalt(); var userObj = new User { Email = email, Password = ComputePasswordHash(password, salt), Salt = salt, ShoppingCart = shoppingCart, UserProfile = userProfile }; UserRepository.SaveOrUpdate(userObj); status = MembershipCreateStatus.Success; return GetUser(userObj.Email, true); } status = MembershipCreateStatus.DuplicateEmail; return null; }