Inner Join core.net

Asked

Viewed 51 times

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 the inner join, it is not clear what you want

  • I need to join the Personal Table, which has the Planoid field, with the Planosservic table.

  • but why the Include is not working?

  • 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.

  • But you don’t need it on Where the Include 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)

  • The other fields of the table, value and type, is pulling normal, in case the description is Planosservicos, the field comes blank.

  • 1

    I who was passing the wrong amount to the table @Barbetta, now worked out, thanks.

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.