0
I’m needing to make a Join Inner to load into a table, if it were without Join Inner I would do it this way:
PessoasServicos = await _context.PessoasServicos
.Include(m => m.PlanosServicos).Where(m => m.PessoaId == id)
.ToListAsync();
Follows as the code of the table:
<table class="table table-condensed table-hover">
<tr>
<th>
@Html.DisplayNameFor(m => m.PessoasServicos.FirstOrDefault().Descricao)
</th>
<th>
@Html.DisplayNameFor(m => m.PessoasServicos.FirstOrDefault().Tipo)
</th>
<th>
@Html.DisplayNameFor(m => m.PessoasServicos.FirstOrDefault().Valor)
</th>
<th></th>
</tr>
@foreach (var item in Model.PessoasServicos) {
<tr>
<th>
@Html.DisplayFor(m => item.Descricao)
</th>
<th>
@Html.DisplayFor(m => item.Tipo)
</th>
<th>
@Html.DisplayFor(m => item.Valor)
</th>
<td>
<a asp-page="Edit" asp-route-id="@item.Id" class="btn btn-sm btn-success">Editar</a>
<button asp-page-handler="Delete" asp-route-id="@item.Id" class="btn btn-danger btn-sm">Excluir</button>
</td>
</tr>
}
</table>
How can I do the Inner Join ? Some example, or something that helps me, thank you.
but the
Include
already is theinner join
, it is not clear what you want– Barbetta
I need to join the Personal Table, which has the Planoid field, with the Planosservic table.
– Mariana
but why the
Include
is not working?– Barbetta
I’m not able to put the part I need that is Personal Services.Planoid = Planosservicos.Id. So that I am doing, it is not appearing in the table, the description field, comes blank.
– Mariana
But you don’t need it on
Where
theInclude
already makes this part alone of Join. Editing: Aah yes, but then I think it’s another problem, rsrs, the description field has value in BD? if possible, add the models(Classes)– Barbetta
The other fields of the table, value and type, is pulling normal, in case the description is Planosservicos, the field comes blank.
– Mariana
I who was passing the wrong amount to the table @Barbetta, now worked out, thanks.
– Mariana