I am not getting filtered record as expected as mentioned in below query. Also I need to perform this as Queryable
I have tried using Include and tried to filter it with Where inside Include itself as a subquery. But of no success.
query.Where(task => ( task.Audit.OrderBy(t => t.OccurredAt).Take(1).Any(p=> (DateFrom.HasValue? p.OccurredAt>= DateFrom:true ) && (DateTo.HasValue? p.OccurredAt <=DateTo:true))));
Here query is a Queryable expression!!
Expected: Need to get the filtered date as per Date range given in Iqueryable format
Actual: Getting all records