Reputation: 883
Repository.Calls
.Count(call => call.OutcomeActionDate.Value >= fourWeeksStartDate &&
call.OutcomeActionDate.Value < threeWeeksStartDate &&
call.UserId == user.UserId);
Above query gives me output 1 and the sql query:
select *
from calls
where userid = 1006 and
outcomeactiondate >= '2013-08-19' and
OutcomeActionDate < '2013-08-26'
gives me the output 15.
The output 15 is correct. I am not sure why is the linq query giving me incorrect value ? All the parameter values used in select query are same as passed in the linq query.
Upvotes: 1
Views: 81
Reputation: 236188
Try to use Date
part of filtered dates:
Calls.Count(call => call.OutcomeActionDate.Value >= fourWeeksStartDate.Date &&
call.OutcomeActionDate.Value < threeWeeksStartDate.Date &&
call.UserId == user.UserId);
Upvotes: 2