Skip to content

Instantly share code, notes, and snippets.

@Pompeu
Created August 16, 2018 02:03
Show Gist options
  • Select an option

  • Save Pompeu/974e331c908482d6ff23d387bc47de6f to your computer and use it in GitHub Desktop.

Select an option

Save Pompeu/974e331c908482d6ff23d387bc47de6f to your computer and use it in GitHub Desktop.
select.cs
/*
tenta evitar for, foreach coiosas que mudão estados.
var listDtoTipoAquecimento = new List<DtoTipoAquecimento>();
foreach (var item in tipoAquecimentos)
{
listDtoTipoAquecimento.Add(
new DtoTipoAquecimento()
{
Id = item.Id,
Nome = item.Nome,
Potencia = item.Potencia,
Tempo = item.Tempo
});
}
*/
private IList<DtoTipoAquecimento> TransformarObjetoParaDto(IList<Dominio.TipoAquecimento> tipoAquecimentos)
{
return tipoAquecimentos
.Select(tipo => new DtoTipoAquecimento {
Id = tipo.Id,
Nome = tipo.Nome,
Potencia = tipo.Potencia,
Tempo = tipo.Tempo
})
.ToList();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment