In the BD it has a field with a float value, which is actually the number of days from the 28/12/1800 date, which the Clarion programming language stores. Well, I have a REST service that is consumed by an Android App. What happens is that I would like to serialize this field, but already as date. If I do out of lambda it works (test), I just need to transforms inside the expression and I do not know how I do it: The command is?
var dt = new DateTime(1800, 12, 28).AddDays(79018).ToString("dd/MM/yyyy");
With this command dt = 02/05/2017
. But I need to load a property from my DTO and it gives an error that LINQ does not support ToString("dd/MM/yyyy");
My lambda is this:
lista = contexto.Liberacoes
//.Where(lib => lib.IdOrcamento == idorcamento)
//.Join(contexto.ItensLibs, lib => lib.IdOrcamento, itens => itens.IdOrcamento, (lib,itens) => new { lib, itens})
.Where(a => a.FlagLiberacao == 1)
.Select(libera => new LiberacaoDTO
{
TipoVenda = libera.TipoVenda,
IdOrcamento = libera.IdOrcamento,
Juros = libera.Juros.ToString(),
Entrada = libera.Entrada.ToString(),
Acrescimo = libera.Acrescimo.ToString(),
Desconto = libera.Desconto.ToString(),
Mensagem = libera.Mensagem,
DataLib = new DateTime(1800,12,28).AddDays(libera.DataLib).ToString("dd/MM/yyyy"),//ERRO AQUI
Vencimento = libera.Vencimento.ToString(),
Vendedor = libera.Vendedor,
Cliente = libera.Cliente,
Filial = libera.Filial
}).ToList();