How could you take away Key’s need or even generate a pseudo ID ?
The most interesting way to do this is to unify all the structures into one Viewmodel with one more property. Let’s call linha
.
In developing the enumeration going to the View, do the following:
var listaParaView = new List<ElementoViewModel>();
int i = 0;
foreach (var elemento in PrimeiraLista)
{
listaParaView.Add(new ElementoViewModel
{
Linha = i++,
// Coloque os demais elementos aqui
});
}
foreach (var elemento in SegundaLista)
{
listaParaView.Add(new ElementoViewModel
{
Linha = i++,
// Coloque os demais elementos aqui
});
}
return View(listaParaView);
How do you return these unions? You are using SQL or
linq
?– Randrade