Hi,
I'd like to get with LINQ an employee list, these employees must have in the TypeOfWorks list the typeofWork passed (Id) in argument
public class Employee
{
public virtual IList<EmployeeTypeOfWork> TypeOfWorks { get; set; }
}
public class EmployeeTypeOfWork
{
public virtual Guid Id { get; set; }
public virtual Employee Employee { get; set; }
public virtual TypeOfWork TypeOfWork { get; set; }
}
public class TypeOfWork
{
public virtual Guid Id { get; set; }
}
public IList<Employee> ListWithTypeOfWork(IList<Employee> Employees,
Guid typeOfWorkId)
{
?????
}
I tried this but I missed something I think
var res = from p in Employees
where (from pp in p.TypeOfWorks
where pp.TypeOfWork.Id == guid select pp.Id).Contains(p.Id)
select p;
Thanks,