0

Its look simple to me also (If I had to use SQL) but I have to do it with LINQ The Issue with this SQL Query.

Select  * from tbl_ClentBranch 
where client_ID in (Select clientID from tbl_Client where blah blah blah..)

I have gone through with lots of googling and find some solution but my scenario is bit different.

The client_ID is nullable, and I just want to ignore the record (of tbl_ClentBranch table) for comparison in where clause if client_ID contains null.

This is what I have done:

var clientID = _client.GetAll().Where(x => x.PortalID == PortalId)
                      .Select(x=>x.ClientID)
                      .ToList();

I am getting list of client but i am not able to use this client list to get clientbranch list Here GetALL() returns IQueryable<Client>

Update:

var clientBranchList = _clientbranch.GetAll().Where(x => x.ClientID.Contains(clientID)).ToList();

Here I am getting issue when trying to get Clientbranch using clientID list

Here GetALL() returns IQueryable<clientBranch>

0 Answers0