I am querying an EF entity MatchHistory:
public partial class MatchHistory
{
public System.Guid ApplicantId { get; set; }
public int BuyerId { get; set; }
public System.DateTime AppliedOn { get; set; }
public int MatchResultId { get; set; }
public System.DateTime ReapplyOn { get; set; }
public virtual MatchBuyer MatchBuyer { get; set; }
}
I currently have this linq statement in my code.
return r.Find()
.Where(x => x.AppliedOn > cutoff && x.MatchResultId == (int)MatchResult.Accepted)
.ToList();
This will return all rows of the type MatchHistory matching the criteria.
However, what I want to do is group by BuyerId and return a count by BuyerId.
Here's the class, I want to output to:
public class QuotaCount
{
public int BuyerId { get; set; }
public int Count { get; set; }
}
Haven't quite managed to get the right syntax together yet - any advice appreciated.