public class OrderItem
{
[Key]
public int ItemId { get; set; }
public int ProductId { get; set; }
public virtual Product product { get; set; }
public int Quantity { get; set; }
}
public class Product
{
[Key]
public int ProductId { get; set; }
}
Here is two my classes. I want to select top 3 most popular products by count of Quantity of each Product. Like:
[ProductTable]
1
2
3
4
[OrderItemTable]
1, 1, 20
2, 2, 10
3, 3, 5
4, 4, 100
5, 3, 25
And the result should be:
4, 3, 1 or list of Products.
Thank you.