Load one page inside another

0

I have a layout page where I want to load information into the notifications button.

For this, I made an action in the controller to return a PartialView where a query will be made in the bd looking for the information.

How do I load this page into the layout so that it passes through the action and loads the information?

public IActionResult Notificacoes()
        {
            var pessoa = (from p in _context.ApplicationUsers where p.Id == _userManager.GetUserId(User) select p).SingleOrDefault();
            var notificacoes = _context.PublicacaoAmigos.Include(m => m.Pessoa).Where(n => n.Status != "Visto").Where(n => n.Amigo == pessoa);
            return PartialView("Notificacoes", notificacoes);
        }

publicacoes.html

@foreach (var item in Model) {

<li>
      <div class="media-body">
          <strong class="notification-title"> @Html.DisplayFor(modelItem => item.Pessoa.Nome) @Html.DisplayFor(modelItem => item.Pessoa.Sobrenome) marcou você </strong>
          <p class="notification-desc">em uma publicação</p>
            @Html.ActionLink("Ver Publicação", "Publicacoes", "Materiais", new{id = item.Pessoa.Id })
          <div class="notification-meta">
            <small class="timestamp">@Html.DisplayFor(modelItem => item.Data)</small>
          </div>
        </div>
    </li>
    }

layout.html

 <ul class="dropdown-menu" id="lista_notificacoes">

   @await Html.PartialAsync("Publicacoes")

    </ul>
    
asked by anonymous 14.10.2018 / 23:59

0 answers