public virtual async Task <TenantDto> CreateAsync(TenantCreateDto input) { var tenant = await TenantManager.CreateAsync(input.Name); input.MapExtraPropertiesTo(tenant); await TenantRepository.InsertAsync(tenant); await CurrentUnitOfWork.SaveChangesAsync(); await DistributedEventBus.PublishAsync( new TenantCreatedEto { Id = tenant.Id, Name = tenant.Name, Properties = { { "AdminEmail", input.AdminEmailAddress }, { "AdminPassword", input.AdminPassword } } }); using (CurrentTenant.Change(tenant.Id, tenant.Name)) { //TODO: Handle database creation? // TODO: Seeder might be triggered via event handler. await DataSeeder.SeedAsync( new DataSeedContext(tenant.Id) .WithProperty("AdminEmail", input.AdminEmailAddress) .WithProperty("AdminPassword", input.AdminPassword) ); } return(ObjectMapper.Map <Tenant, TenantDto>(tenant)); }
public async Task <TenantDto> CreateAsync(TenantCreateDto input) { var tenant = await _tenantManager.CreateAsync(input.Name); await _tenantRepository.InsertAsync(tenant); return(ObjectMapper.Map <Tenant, TenantDto>(tenant)); }
public virtual async Task <TenantDto> CreateAsync(TenantCreateDto input) { var tenant = await TenantManager.CreateAsync(input.Name); await TenantRepository.InsertAsync(tenant); using (CurrentTenant.Change(tenant.Id, tenant.Name)) { //TODO: Handle database creation? //TODO: Set admin email & password..? await DataSeeder.SeedAsync(tenant.Id); } return(ObjectMapper.Map <Tenant, TenantDto>(tenant)); }
public virtual async Task <TenantDto> CreateAsync(TenantCreateDto input) { var tenant = await TenantManager.CreateAsync(input.Name); await TenantRepository.InsertAsync(tenant); using (CurrentTenant.Change(tenant.Id, tenant.Name)) { //TODO: Handle database creation? await DataSeeder.SeedAsync( new DataSeedContext(tenant.Id) .WithProperty("AdminEmail", input.AdminEmailAddress) .WithProperty("AdminPassword", input.AdminPassword) ); } return(ObjectMapper.Map <Tenant, TenantDto>(tenant)); }
public virtual Task <TenantDto> CreateAsync(TenantCreateDto input) { ValidateModel(); return(TenantAppService.CreateAsync(input)); }
public virtual Task <TenantDto> CreateAsync(TenantCreateDto input) { return(_service.CreateAsync(input)); }