I would like to return the top 10 most sold products (most quantity) during dates specified by the user.
My tables from the database:
Orders
OrderId | OrderDate
Order_Products:
ProductID | OrderID | Quantity
Products
ProductID | ProductName | ProductDescription
Code:
return (from product in this.Entities.Products
from orderProduct in this.Entities.Order_Product
from order in this.Entities.Orders
where order.OrderId = orderProduct.ProductID && orderProduct.ProductID == product.ProductID
where (order.OrderDate >= date1 && <= date2)
select product).OrderByAscending(COUNT(Quantity)).Distinct().Take(10);
code up to now.