How can I get all elements that are in another list by ID? For eg; I have List roles; I\'d like to get all roles from the database that are in this this list by their Id.
var listOfRoleId = user.Roles.Select(r => r.RoleId); var roles = db.Roles.Where(r => listOfRoleId.Contains(r.RoleId));