How to write a LINQ query to return Bool
value?
My code thus far,
public class AddNewRow
{
public static Func<DatabaseDataContext, DateTime, int, Staff_Time_TBL>
GetNewRowMissingData =
CompiledQuery.Compile((DatabaseDataContext db, DateTime dDate, int staffNo) =>
db.Staff_Time_TBLs.Any(a => a.Date_Data == dDate && a.Staff_No == staffNo));
}
and tried this as well,
public class AddNewRow
{
public static Func<DatabaseDataContext, DateTime, int, Staff_Time_TBL>
GetNewRowMissingData =
CompiledQuery.Compile((DatabaseDataContext db, DateTime dDate, int staffNo) =>
db.Staff_Time_TBLs.Where(a => a.Date_Data == dDate && a.Staff_No == staffNo).Any());
}
So if both criteria are met then return true.
Any of the other code I have tried will just clutter the post.
Research links,
Plus I have the book Pro C# 5.0 and the .NET 4.5 Framework (Expert's Voice in .NET) which I am referencing from.