title: How do you display a users full name in the login partial view in ASP.NET Core
body: <p>I'm new to ASP.NET Core, most of my existing experience is with Java/PHP, and a little ASP.NET MVC about 10 years ago.</p>
  
  <p>I'm using a Mac so I'm trying to build a project using Visual Studio Code and ASP.NET Core.</p>
  
  <p>I've created a web application using 'yo'. I've changed the default database connection string to use an MSSQL database I have on a server. I've ran the <code>dotnet ef database update</code> command to create the necessary tables in the database.</p>
  
  <p>I wanted to add firstname and lastname to the user, so I've created the columns in the AspNetUser table, and edited the <code>ApplicationUser</code> class to reflect this;</p>
  
  <pre class="lang-cs prettyprint-override"><code>namespace pabulicms.Models
  {
      // Add profile data for application users by adding properties to the ApplicationUser class
      public class ApplicationUser : IdentityUser
      {    
          public string Firstname { get; set; }
          public string Lastname { get; set; }
      }
  }
  </code></pre>
  
  <p>I've gone ahead and amended the view model for the registration form to include the firstname and lastname, and I've updated the Signup method so that the firstname and lastname is saved to the database.</p>
  
  <p>By default the _LoginPartial.cshtml view displays the users username(email address), I'd like to change this to display the users full name, but I'm unsure as to how I do this.</p>
  
  <p>This is what the <code>_LoginPartial</code> looks like at the moment;</p>
  
  <pre class="lang-cs prettyprint-override"><code>@using Microsoft.AspNetCore.Identity
  @using pabulicms.Models
  
  @inject SignInManager&lt;ApplicationUser&gt; SignInManager
  @inject UserManager&lt;ApplicationUser&gt; UserManager
  
  @if (SignInManager.IsSignedIn(User))
  {
      &lt;form asp-area="" asp-controller="Account" asp-action="Logout" method="post" id="logoutForm" class="navbar-right"&gt;
          &lt;ul class="nav navbar-nav navbar-right"&gt;
              &lt;li&gt;
                  &lt;a asp-area="" asp-controller="Manage" asp-action="Index" title="Manage"&gt;Hello @UserManager.GetUserName(User)!&lt;/a&gt;
              &lt;/li&gt;
              &lt;li&gt;
                  &lt;button type="submit" class="btn btn-link navbar-btn navbar-link"&gt;Log out&lt;/button&gt;
              &lt;/li&gt;
          &lt;/ul&gt;
      &lt;/form&gt;
  }
  else
  {
      &lt;ul class="nav navbar-nav navbar-right"&gt;
          &lt;li&gt;&lt;a asp-area="" asp-controller="Account" asp-action="Register"&gt;Register&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a asp-area="" asp-controller="Account" asp-action="Login"&gt;Log in&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
  }
  </code></pre>
  
  <p>It's obviously this line I need to change;</p>
  
  <pre><code>Hello @UserManager.GetUserName(User)!
  </code></pre>
  
  <p>However changing it to <code>@UserManager.GetFirstname(User)!</code> doesn't work, as it tells me that the method <code>GetFirstname</code> doesn't exist;</p>