There are classes of models
public class Product { public int ProductID { get; set; } public string ProductName { get; set; } public string Category { get; set; } public decimal UnitPrice { get; set; } public int UnitsInStock { get; set; } } public class Order { public int OrderID { get; set; } public DateTime OrderDate { get; set; } public decimal Total { get; set; } } It is necessary to get all customers who have orders that exceed the sum value
I made the following request
var customers = from c in dataSource.Customers from o in c.Orders where o.Total > value select c).Distinct(); Displays what you need.
It is necessary to execute this query in the dot notation, I try to do this:
var customers = dataSource.Customers.Select(c => c.Orders .Where(o => o.Total > value)) .Distinct(); it turns out that the query returns IEnumerable<IEnumerable<Order>> , and I need IEnumerable<Customers> . Please tell me where I am wrong, and how to make requests of this kind correctly.