0
I have in BD a Datanascimento field, where it is gurdada in YYYY-mm-dd format. I have a javascript function that scans the table by last CPF. If there is registration for the CPF, then it assembles the fields in the form. It turns out that the Date of Birth, in the form, is mounted with three option objects (Combobox), like this: Dia Mes Ano.
How do I make in my controller a method that returns me the date of the BD dismembered, for me to click in my form?
Use LINQ like this:
var Result = (from a in db.TB_CLIENTES
where a.CdCliente == "1" && a.CPF == _cpf
select new
{
a.Nome,
a.Endereco,
a.Numero,
a.CEP,
a.Complmento,
a.Telefone,
a.Celular
}).ToList();
What is the type of property
DataNascimento
on your domain model? It’sstring
, or isDateTime
?– Miguel Angelo
I solved it like this: Dia = a.DataNascimento.Value.Day, Mes = a.DataNascimento.Value.Month, Year = a.DataNascimento.Value.Year, completing my LINQ
– pnet