Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

How to get the Admin Email Address for tenant. #2159


User avatar
0
th3monk3y created

Not sure what I'm missing here, but I can't seem to find the navigation property for the User Email Address for a tenant. Also need to be able to update it. The TenantForEditInput only contains the tenant id.

Thanks

public async Task<TenantForEditDto> GetTenantForEdit(TenantForEditInput input)
        {
            var tenant = await _tenantManager.GetByIdAsync(input.id);

            TenantForEditDto tenantDto = new TenantForEditDto() { Tenant = tenant.MapTo<TenantDto>() };

            tenantDto.Tenant.AdminEmailAddress = //?? help

            return tenantDto;
        }

1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can switch to given tenant's context and get the admin user using a repository or usermanager. To do that, you can use something like this.

    using (CurrentUnitOfWork.SetTenantId(input.id)) { var adminUser = UserManager.FindByNameAsync(User.AdminUserName); }

    A tenant can have more than one user and users of a tenant can be stored in a seperate database from tenant itself. Because of these two reasons there is no navigation property.