0
maharatha created
I am using multiple database context.
Database 1 - Table Name :Client Database 2 - Table Name : Tenant (This is the abpzero database)
Then I have extended the Tenant table to store Client Id from Table Client to have a mapping between Tenant and Client.
I am creating a drop down which will display clients which are not yet mapped to tenant.
Repository for Client -- _client Repository using ITenantAppService to Get Tenants var tenants = await _tenantAppService.GetTenants(new GetTenantsInput());
once I get the tenants I would like to write a query to only get those clients which have not been mapped with the tenant.
Not able to figure out how to write it.
1 Answer(s)
-
0
var clientIds = tenants.Select(t => t.ClientId).ToList(); var clientsWhichHaveNotBeenMappedWithATenant = _clientRepository.GetAll() .Where(c => !clientIds.Contains(c.Id)) .ToList();