Render data from database in layout file
<p>I want to include data (fetching from a database) in the _layout file of my asp.net mvc core project.</p>

<p>Situation:</p>

<p><strong>_Layout page</strong></p>

<pre><code>@if (SignInManager.IsSignedIn(User))
{
   Html.Action("Modules", "Layout")
}
</code></pre>

<p><strong>Controllers/LayoutController.cs</strong></p>

<pre><code>using Microsoft.AspNetCore.Mvc;

namespace project.Controllers
{
   public class LayoutController : Controller
   {
       ...

       public ActionResult Modules()
       {
           ///Return all the modules
           return PartialView("_Modules", moduleAccess.ToList());
       }
   }
}
</code></pre>

<p><strong>Views/Shared/_Modules.cshtml</strong></p>

<pre><code>@model IEnumerable&lt;project.Models.Module&gt;
&lt;div class="two wide column"&gt;
&lt;div class="ui menu" id="modules"&gt;
    @foreach (var item in Model)
    {
        &lt;a class="item"&gt;
            @Html.DisplayFor(modelItem =&gt; item.Name)
        &lt;/a&gt;
    }
&lt;/div&gt;
</code></pre>

<p></p>

<p>When going the webpage I get the following error:</p>

<pre><code>'IHtmlHelper&lt;dynamic&gt;' does not contain a definition for 'Action' and the best extension method overload 'UrlHelperExtensions.Action(IUrlHelper, string, object)' requires a receiver of type 'IUrlHelper'
</code></pre>

<p>What am I doing wrong? How can I get the data in the layout page?</p>