I am using Entity Framework 5.0, and I have a problem with a LINQ query. I have the following method that accepts an integer value which is then passed into the query. This works fine.
public IList<tblcoursebooking> GetStandardReport(int AttendanceID)
{
return _UoW.tblcoursebookingRepo.All
.Where(cb => cb.Attended.Equals(AttendanceID)
.ToList();
}
However, I need to change the method so that it accepts a List of integers, and then pulls out all records where Attended is equal to any of the List of integers. Something like this
public IList<tblcoursebooking> GetStandardReport(List<int> AttendanceIDs)
{
return _UoW.tblcoursebookingRepo.All
.Where(cb => cb.Attended.Equals == any AttendanceIDs
.ToList();
}
I would like to do try and use the Contains or Any LINQ keywords, however, as Attended is a single value, not a collection, the only properties available to me after the dot are
CompareTo, Equals, GetHashCode, GetType, GetTypeCode, ToString
Could someone please help?
Thanks for your time.