@namespace Oqtane.Modules.Admin.Tenants @inherits ModuleBase @inject NavigationManager NavigationManager @inject ITenantService TenantService @inject IInstallationService InstallationService
Cancel @code { public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } } string name = ""; string connectionstring = ""; string schema = ""; private async Task SaveTenant() { ShowProgressIndicator(); connectionstring = connectionstring.Replace("\\\\", "\\"); GenericResponse response = await InstallationService.Install(connectionstring); if (response.Success) { Tenant tenant = new Tenant(); tenant.Name = name; tenant.DBConnectionString = connectionstring; tenant.DBSchema = schema; tenant.IsInitialized = false; await TenantService.AddTenantAsync(tenant); NavigationManager.NavigateTo(NavigateUrl()); } else { AddModuleMessage(response.Message, MessageType.Error); } } }