Break apart date to load in javascript

0

I have in the DB a DateNode field, where it is stored in the format YYYY-mm-dd. I have a javascript function that scans the table by the last CPF. If there is registration for the CPF, then it mounts the fields in the form. It turns out that the Birthdate, in the form, is mounted with three option objects (Combobox), like this: Day Month Year.

How do I do in my controller a method that returns me to the disassembled DB Date, so I can load it on 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();
    
asked by anonymous 19.03.2014 / 18:49

1 answer

1
var Result = (from a in db.TB_CLIENTES
    where a.CdCliente == "1" && a.CPF == _cpf
    select new
    {
        Nome = a.Nome,
        Endereco = a.Endereco,
        Numero = a.Numero,
        CEP = a.CEP,
        Complemento = a.Complemento,
        Telefone = a.Telefone,
        Celular = a.Celular,
        DiaNascimento = a.DataNascimento.Value.Day,
        MesNascimento = Ano = a.DataNascimento.Value.Month,
        AnoNascimento = a.DataNascimento.Value.Year
    }).ToList();
    
19.03.2014 / 19:34