Hello,
I have a class "Employee", this has an IList<> of "TypeOfWork".
public class Employee
{
public virtual IList<TypeOfWork> TypeOfWorks { get; set; }
}
public class TypeOfWork
{
public virtual Customer Customer { get; set; }
public virtual Guid Id { get; set; }
public virtual string Name{ get; set; }
public virtual bool IsActive{ get; set; }
}
before saving, I'd lile to know if "typeofwid" (a Guid) is already in the "TypeOfWorks" collection.
I tried this :
var res = from p in employee.TypeOfWorks
where p.Id == new Guid("11111111-1111-1111-1111-111111111111")
select p ;
and tried this :
bool res = employee.TypeOfWorks.Where(f => f.Id == new Guid("11111111-1111-1111-1111-111111111111")).Count() != 0;
in the "Immediate Window" of Visual Studio but I receive the error : Expression cannot contain query expressions in both case
Do you have an idea ?
Thanks,