views:

38

answers:

1

I have simple search page i want to filter the results.

var TransactionStats = from trans in context.ProductTransactionSet.Include("SPL")
    select new
    {
        trans.InvoiceNo,         
        ProductGroup = from tranline in trans.ProductTransactionLines
            group tranline by tranline.ProductTransaction.TransactionID
            into ProductGroupDetil
            select new
            {
                TransactionDateTime = ProductGroupDetil.Select
                    (Content => Content.TransactionDateTime)
            }
    };

I want to use TransactionDateTime in where clause when required.

if (_FilterCrieteria.DateFrom.HasValue)
{
    TransactionStats.Where
    (
        a => a.ProductGroup.Where
            (
                dt => dt.DateofTransaction >= _FilterCrieteria.DateFrom &&
                    dt.DateofTransaction >= _FilterCrieteria.DateFrom
            )
    )
}

Can any one correct the syntax?

A: 

The third row in your second code block should probably read:

    TransactionStats = TransactionStats.Where
Lette