@namespace Oqtane.Modules.Admin.Tenants @inherits ModuleBase @inject NavigationManager NavigationManager @inject ITenantService TenantService
Cancel @code { public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } } int tenantid; string name = ""; string connectionstring = ""; string schema = ""; protected override async Task OnInitializedAsync() { try { tenantid = Int32.Parse(PageState.QueryString["id"]); Tenant tenant = await TenantService.GetTenantAsync(tenantid); if (tenant != null) { name = tenant.Name; connectionstring = tenant.DBConnectionString; schema = tenant.DBSchema; } } catch (Exception ex) { ModuleInstance.AddModuleMessage(ex.Message, MessageType.Error); } } private async Task SaveTenant() { Tenant tenant = await TenantService.GetTenantAsync(tenantid); if (tenant != null) { tenant.Name = name; tenant.DBConnectionString = connectionstring; tenant.DBSchema = schema; await TenantService.UpdateTenantAsync(tenant); } NavigationManager.NavigateTo(NavigateUrl()); } }