public void ProvisionTenant(TenantViewModel tenant, StaffViewModel administrator) { ProvisionTenantCommand command = new ProvisionTenantCommand( tenant.Name, tenant.Description, administrator.FirstName, administrator.LastName, administrator.EmailAddress, administrator.PrimaryTelephone, administrator.SecondaryTelephone, administrator.AddressStreetAddress, administrator.AddressCity, administrator.AddressStateProvince, administrator.AddressPostalCode, administrator.AddressCountryCode ); var _tenant = _identityApplicationService.ProvisionTenant(command).Result; TenantCreatedEvent tenantCreatedEvent = new TenantCreatedEvent( _tenant.Id, _tenant.Name, _tenant.Description ); _eventPublisher.Publish <TenantCreatedEvent>(tenantCreatedEvent); }
public void ProvisionTenant(TenantViewModel tenant, StaffViewModel administrator) { ProvisionTenantCommand command = new ProvisionTenantCommand( tenant.Name, tenant.Description, administrator.FirstName, administrator.LastName, administrator.EmailAddress, administrator.PrimaryTelephone, administrator.SecondaryTelephone, administrator.AddressStreetAddress, administrator.AddressCity, administrator.AddressStateProvince, administrator.AddressPostalCode, administrator.AddressCountryCode ); var _tenant = _identityApplicationService.ProvisionTenant(command); //TenantCreatedEvent tenantCreatedEvent = new TenantCreatedEvent( // Guid.Parse(_tenant.TenantId_Id), // _tenant.Name, // _tenant.Description //); //_eventPublisher.Publish<TenantCreatedEvent>(tenantCreatedEvent); //_businessInformationService.ProvisionSite(_tenant.TenantId.Id, _tenant.Name, //_tenant.Description, _tenant.Active); }
public async Task <IActionResult> Register([FromBody] TenantViewModel tenant, StaffViewModel administrator ) { //throw new NotImplementedException(); if (!ModelState.IsValid) { //NotifyModelStateErrors(); return((IActionResult)BadRequest()); } ProvisionTenantCommand command = new ProvisionTenantCommand( tenant.Name, tenant.Description, administrator.FirstName, administrator.LastName, administrator.EmailAddress, administrator.PrimaryTelephone, administrator.SecondaryTelephone, administrator.AddressStreetAddress, administrator.AddressCity, administrator.AddressStateProvince, administrator.AddressPostalCode, administrator.AddressCountryCode ); var _tenant = await _identityApplicationService.ProvisionTenant(command); return((IActionResult)Ok(_tenant)); }
public Tenant ProvisionTenant(ProvisionTenantCommand command) { return this.tenantProvisioningService.ProvisionTenant( command.TenantName, command.TenantDescription, new FullName(command.AdministorFirstName, command.AdministorLastName), new EmailAddress(command.EmailAddress), new PostalAddress( command.AddressStreetAddress, command.AddressCity, command.AddressStateProvince, command.AddressPostalCode, command.AddressCountryCode), new Telephone(command.PrimaryTelephone), new Telephone(command.SecondaryTelephone)); }
public Task <Tenant> ProvisionTenant(ProvisionTenantCommand command) { Tenant tenant = this.tenantProvisioningService.ProvisionTenant( command.TenantName, command.TenantDescription, new FullName(command.AdministorFirstName, command.AdministorLastName), new EmailAddress(command.EmailAddress), new PostalAddress( command.AddressStreetAddress, command.AddressCity, command.AddressStateProvince, command.AddressPostalCode, command.AddressCountryCode), new Telephone(command.PrimaryTelephone), new Telephone(command.SecondaryTelephone)); this.unitOfWork.Commit(); return(Task.FromResult(tenant)); }
static void Main(string[] args) { var optionsBuilder = new DbContextOptionsBuilder <IdentityAccessDbContext>(); optionsBuilder .UseMySql("Server=localhost;database=IdentityAccess;uid=root;pwd=P@ssword;oldguids=true;SslMode=None") .EnableSensitiveDataLogging(); IdentityAccessDbContext context = new IdentityAccessDbContext(optionsBuilder.Options); //IdentityApplicationService identityApplicationService = new IdentityApplicationService(); //setup our DI var serviceProvider = new ServiceCollection() .AddScoped(s => context) .AddSingleton <AuthenticationService>(_ => new AuthenticationService( _.GetService <ITenantRepository>(), _.GetService <IUserRepository>(), _.GetService <IEncryptionService>())) .AddSingleton <GroupMemberService>(_ => new GroupMemberService( _.GetService <IUserRepository>(), _.GetService <IGroupRepository>())) .AddSingleton <TenantProvisioningService>(_ => new TenantProvisioningService( _.GetService <ITenantRepository>(), _.GetService <IUserRepository>(), _.GetService <IRoleRepository>())) .AddSingleton <ITenantRepository, TenantRepository>() .AddSingleton <IUserRepository, UserRepository>() .AddSingleton <IRoleRepository, RoleRepository>() .AddSingleton <IGroupRepository, GroupRepository>() .AddSingleton <IEncryptionService, MD5EncryptionService>() .AddSingleton <IdentityApplicationService>(s => new IdentityApplicationService( s.GetService <AuthenticationService>(), s.GetService <GroupMemberService>(), s.GetService <IGroupRepository>(), s.GetService <TenantProvisioningService>(), s.GetService <ITenantRepository>(), s.GetService <IUserRepository>() )) .AddTransient <IInt, Greeter>() .AddTransient <PrivateClass>() .BuildServiceProvider(); using (var scope1 = serviceProvider.CreateScope()) { var p = scope1.ServiceProvider; //IInt @int = p.GetService<IInt>(); //@int.Greeting(); PrivateClass privateClass = p.GetService <PrivateClass>(); privateClass.Greet(); TenantProvisioningService tenantProvisioningService = p.GetService <TenantProvisioningService>(); ProvisionTenantCommand command = new ProvisionTenantCommand( "abc" + Guid.NewGuid().ToString().Replace("-", ""), "description", "Jack" + Guid.NewGuid().ToString(), "Leung" + Guid.NewGuid().ToString(), "abc" + Guid.NewGuid().ToString().Replace("-", "") + "*****@*****.**", "123-123-1234", "123-123-1234", "123", "123", "123", "123", "123" ); IdentityApplicationService identityApplicationService = p.GetService <IdentityApplicationService>(); identityApplicationService.ProvisionTenant(command); //using (var processor = new ReservationCommandProcessor()) //{ // processor.Start(); // Console.WriteLine("Host started"); // Console.WriteLine("Press enter to finish"); // Console.ReadLine(); // processor.Stop(); //} } }