I have the following method to get a person detail by id. I want to add where condition to the include ie. Where(subordinates => subordinates.Active)
. Can anyone help me how to do this?
public async Task<PersonDetails> GetPerson(int id)
{
var hasSensitiveAccess = _permissionsService.GetSensitiveAccess();
return await _context.User
.Include(user => user.Manager)
.Include(user => user.InverseManager) //want to include only active subordinates
.AsNoTracking()
.Where(user => user.Id == id)
.Select(UserDetailsMappingSelector.ToViewModel(hasSensitiveAccess))
.FirstOrDefaultAsync();
}
Thanks