Using Where method in Linq 2 Entities with OR clause.
- by Dani
I want to use Where method in Linq 2 entities that will be equal to this
userRepository.Users.Where(u=>u.RoleID == 1 || u=>u.RoldID == 2).Select(o => new SelectListItem { Text = o.Role.RoleName, Value = o.RoleID.ToString() }).ToList();
The problem of course is in Where(u=u.RoleID == 1 || u=u.RoldID == 2)
The problem is that I don't know how to use WHERE method with OR inside the WHERE clause.
any ideas (the code above will not compile of-course b/c of the lambda expression.
userRepository.Users returns an list of Users entities.
I guess that and can be done using concatenation of .Where().Where() but I need an OR.