Expression inside a lambda gives error

2

I created a lambda and tried to create one or one expression or another. With or (||) did not work. There, instead of || I've been adding Where. That's right? This is it now:

var resultado = db.T_CRM_StatusPDV
                .Where(a => a.DT_TransacaoV < diaAnt)
                .Where(b => b.DT_ControleV < dataControle)
                .Where(c => c.DE_Cnpj == cnpj)
                .Select(i => new { i.DE_Cnpj }).ToList();
    
asked by anonymous 30.05.2014 / 02:01

1 answer

4

With || and &&

var resultado = 
  db.T_CRM_StatusPDV
      .Where(a => (a.DT_TransacaoV < diaAnt || a.DT_ControleV < dataControle) && a.DE_Cnpj == cnpj)
      .Select(i => new { i.DE_Cnpj })
      .ToList();

Obs: Notice where the parentheses go

    
30.05.2014 / 02:53