I am working on entity framework project, i have to apply Or condition in dbContext.Where
I have tried this but its giving me error “Operator || cannot be applied to operand of types lambda expressions”
return dataContext.Friends
.Where((r => r.ToUserId == touserid && r.FromUserId == fromuserid)
|| (r => r.ToUserId == fromuserid&& r.FromUserId == touserid ))
.ToList();
I also tried using && instead of || but its giving me same error for &&,how can i apply Or condition for this senario?
I have tried without brackets as well
You need to do it like this:
The only difference is that I deleted the second
r =>and fixed the parenthesis.