What's the equivalence of an SQL WHERE in Lambda expressions?

asp.net-mvc, c#, entity-framework, lambda

Solution

Use Enumerable.Where

decimal sum = _myDB.Products
                   .Where(p => (p.Date >= start) && (p.Date <= end) )
                   .Sum(p => p.Price)
                   .GetValueOrDefault();

Problem

Here's what I have: ``` decimal sum = _myDB.Products.Sum(p => p.Price).GetValueOrDefault(); ``` I also have two dates: `DateTime start`, `DateTime end` I want to retrieve the sum of all of the product prices between start and end, but I can't figure out how to incorporate the variables into the lambda equation. How do you incorporate variables into a lambda equation to give it some specification?

Original source