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.
Something like this should work if user.Roles is a list of ints:
var roles = db.Roles.Where(r => user.Roles.Contains(r.RoleId));
That turns it into a "SELECT WHERE IN (x, y, z...)" in SQL.