0
Hello, I have a print method, which makes several left join
, it is bringing the values I want, but some of these values are coming duplicated, as shown in the images:
Table TabelaImposto
: select TbImp_codigo, TbImp_TpMdobc from TabelaImposto
Table TipoModBaseICMS
: select TpMdoBC_Codigo, TpMdoBC_Descricao from TipoModBaseICMS
My method:
[HttpGet]
[Route("imprimir2")]
public HttpResponseMessage Imprimir2()
{
try
{
var result = new HttpResponseMessage(HttpStatusCode.OK);
var impostos = (from a in bdprincipalEntities.TabelaImposto
join e in bdprincipalEntities.TipoModBaseICMS on a.TbImp_TpMdobc
equals e.TpMdoBC_Codigo into a_e
from e in a_e.DefaultIfEmpty()
select new
{
a.TbImp_codigo,
e.TpMdoBC_Descricao
}).ToList();
result.Content = new StringContent(JsonConvert.SerializeObject(impostos));
result.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
return result;
}
catch (Exception)
{
return new HttpResponseMessage(HttpStatusCode.BadRequest);
}
}
For the result in the image
TbImp_Codigo
is a different value just the description that hit, on the table how are the results? 'cause from the looks of it you’re right, like that’s what it’s to bring, it’s got to explain a few more details?– novic
I will edit the question and try to give more detail
– Jeff Henrique
@Virgilionovic could tell me if you’re easier to understand or find the problem?
– Jeff Henrique
Just look at the table that the codes have no unique identity ... that’s why expensive!
– novic