var date = DateTime.Now.AddMonths(-3);
buyers.OrderBy(x => x.Visits.Where( y => y.VisitStart > date).Count());
In the orderby expression I get Cannot convert lambda expression to type 'string' because it is not a delegate type. What the code is supposed to do is sort my "buyers" by number of "visits" they had in last 3 months.
Buyers is entity that has List of Visits and Visit has DateTime VisitStart
If it makes any difference,buyers is IQueryable<Buyer> and Visits is ICollection<Visit>
buyers?Visits? andVisitStart?