The query below:
IEnumerable<activity> activityList = PortalContext.activity.Where(item =>
item.schakeling_id == newActivity.schakeling_id &&
item.startdt.Date == DateTime.Now.Date);
I am getting this error:
"The specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported."
I have tried multiple different ways but can't get it working. Any help would be appreciated.
Create a date variable outside of your query:
var currentdate=DateTime.Now.Date;
var activityList = PortalContext.activity.Where(item =>
item.schakeling_id == newActivity.schakeling_id
&& item.startdt.Date == currentdate);