I must to retry a nullable Datetime from an Entity Framework and convert it in a Masked string of this type: ToString("dd-MM-yyyy")
I retry all the value with this code(now i show the only DataLead)
var dbResult = conc.Clientes.Where(x => x.StatoCliente == "1").ToList();
var leads = from e in dbResult
select new
{
e.DataLead
} into selectedLead
select selectedLead;
return Json(leads, JsonRequestBehavior.AllowGet);
In other part of my code i do the conversion with this code:
DateTime date = (DateTime) DataLead;
string dateElaborated = date.ToString("dd-MM-yyyy");
But, how can i do this operation in my LINQ selection function?
Thanks to all