public void Execute(CreateNewCustomerAccountCommand command) { var spec = new CustomerAccountHasUsername(command.Email); var accs = AccountRepository.FindAll(spec); if (accs.Any()) { //Account with username already exists. throw new Exception("Can not create CustomerAccount"); } var acc = new CustomerAccount(); acc.CreateLocalMembership(command.Email, command.Password); }
public string Create(string username, string salt, string password, string activationToken) { var spec = new CustomerAccountHasUsername(username); var accs = _repository.FindAll(spec); if (accs.Any()) { //Account with username already exists. throw new Exception("Can not create CustomerAccount"); } var acc = new CustomerAccount(); acc.CreateLocalMembership(username, password); _repository.Store(acc); return(acc.Id); }