public User Register(RegisterUserCommand command) { var tenant = new Tenant(command.FullName, string.Empty); var user = tenant.RegisterTenantUser(command.UserName, command.Password, command.Email); if (tenant.IsValid(user)) { _tenantRepository.Register(tenant, user); DomainEvents.Raise(new UserRegistered(user)); return user; } return null; }
public void Register(Tenant tenant, User user) { _dataContext.Tenants.Add(tenant); _dataContext.Users.Add(user); _dataContext.SaveChanges(); }