I have the following statement in the controlller
public JsonResult GetLote(DateTime dataAbate, int numeroSequencia)
{
db.Configuration.ProxyCreationEnabled = false;
var query = from a in db.Lotes
join b in db.LoteGeneros on a.LoteId equals b.LoteId
join c in db.Generos on b.GeneroId equals c.GeneroId
where a.DataAbate == dataAbate && (c.SequenciaInicial <= numeroSequencia && c.SequenciaFinal >= numeroSequencia)
select new { NumeroDoLote = a.NumeroLote};
if(query.Count() <= 0)
{
//CASO query venha com Count 0
//Como fazer para NumeroDoLote receber 0 (zero)
}
return Json(query);
}
How do I get the value inside select new { NumeroDoLote receba 0 }
if the search returns nothing?