3
As I pass the Where of this max datatransaction, ie I wish to bring the result but by the highest date.
var resultado = (from ci in webDB.T_Controle_Importacao
where ci.CNPJ == cnpj
let dd = EntityFunctions.DiffDays(DateTime.Now, ci.DataTransacao)
select dd >= 45 ? 3
: dd >= 15 ? 2
: 1).Take(1);