Fetching data according to Id

Posted by Rasagna under LINQ on 3/18/2016 | Points: 10 | Views : 1864 | Status : [Member] | Replies : 1
Hii,
I have two methods like

       public IEnumerable<DataAccessModel.Claim> GetAllClaims()
{
return claimDataService.GetClaimRecords();
}

where Claim table contains Id and other columns like category etc..

        public IEnumerable<DataAccessModel.GroupClaim> GetClaimsForGroup(Guid groupId)
{
return groupDataService.GetGroupClaimRecords().Where(x => x.GroupId == groupId);
}

GroupClaim table cointains ClaimId and GroupId columns where ClaimId corresponds to Id from Claim table

Now I have to populate in a list available ClaimIds ie Ids from Claim table which must not contain Id s from GroupClaim
I have tried out the below code but not working.

     public IEnumerable<DataAccessModel.Claim> AvailableGroupClaims(Guid groupId)
{
return claimDataService.GetClaimRecords().Where(y => groupDataService.GetGroupClaimRecords().Where(x => x.GroupId == groupId).Any(a => a.ClaimId != y.Id));
}





Responses

Posted by: Rajnilari2015 on: 3/22/2016 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 25

Up
0
Down
@Rasagna,
Please perform a JOIN followed by a Where for filtering the records.

Hope that helps

--
Thanks & Regards,
RNA Team

Rasagna, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response