Displaying current username in _Layout view : <p>I am wanting to display the current ApplicationUsers Firstname+Lastname on my navigation bar on my _Layout view. I've found that you can pass your viewbag from the current RenderedBody controller like so:</p>

<pre><code>  private readonly IHttpContextAccessor _httpContext;
    private readonly UserManager&lt;ApplicationUser&gt; _userManager;
    private readonly ApplicationUser _user;

    public HomeController(IHttpContextAccessor httpContextAccessor, UserManager&lt;ApplicationUser&gt; userManager) {
       _httpContext = httpContextAccessor;
       _userManager = userManager;
        _user = _userManager.Users.Single(u =&gt; u.Id == _httpContext.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value);
    }
</code></pre>

<p>And in a controller:</p>

<pre><code>public IActionResult Index()
    {

        ViewBag.Username = $"{_user.FirstName} {_user.Surname}";
        return View();
    }
</code></pre>

<p>Finally in my _Layout View:</p>

<pre><code>&lt;strong class="font-bold"&gt;@ViewBag.Username&lt;/strong&gt;
</code></pre>

<p>This method seems like it's going against the grain and would be a huge pain to do for every view. What would be the standard in achieving this?</p>
