My ApplicationUser
class has a property called CompanyID
.
All users are tied to a specific company. Now I'd like to list user accounts by CompanyID
but can't figure out how to do it, UserManager.findxxx
seem to be limited to whats built in and I can't seem to query it about custom properties.
Incase you extended the User
model class with the CompanyId
field:
var context = new ApplicationDbContext();
var usersByCompanyId = context.Users.Where(user => user.CompanyID == 1234).ToList();