I have a table as follows:
public class Producao
{
string unidade;
string profissional;
string procedimento;
}
I can get all the records stored in the table and throw them in a listaProducao
list. And list them by foreach
as follows:
<table>
<tr>
<td>Unidade</td>
<td>Profissional</td>
<td>Procedimento</td>
</tr>
@foreach (var item in Model)
{
<tr>
<td>@item.unidade</td>
<td>@item.profissional</td>
<td>@item.procedimento</td>
</tr>
}
</table>
The result is similar to the one shown below:
unidade - profissional - procedimento
1 1 1
1 2 1
1 2 2
1 3 1
1 3 3
What I want is to generate a result like this:
UNIDADE 1
--------------------
PROFISSIONAL 1
--------------------
procedimento 1
--------------------
PROFISSIONAL 2
--------------------
procedimento 1
procedimento 2
--------------------
PROFISSIONAL 3
--------------------
procedimento 1
procedimento 3
Notice that the result is similar to a Master / Detail report, where you first list the unit, all its professionals, and its procedures. Then list another drive if you have it in the table.
Any tips on how to do this?