public User UpdateEmail(User userData, IEmailValidator emailValidator) { var user = GetById(userData.Id); VerifyIfUserIsNull(user); emailValidator.ValidateEmail(userData.Email); user.Email = userData.Email; Repository.Update(user); return(user); }
public bool Create(User user, string password, string confirmPassword, IPasswordValidator passwordValidator, IEmailValidator emailValidator) { if (UserAlreadyExists(user.Id, user.Name)) { throw new InvalidOperationException(); } emailValidator.ValidateEmail(user.Email); user.CreatePassword(password, confirmPassword, passwordValidator); Repository.Create(user); return(true); }