@inject Microsoft.AspNetCore.Identity.UserManager<Microsoft.AspNetCore.Identity.IdentityUser> userManager
@{
  var user = await userManager.GetUserAsync(User);
}

@if(User.Identity.IsAuthenticated) {
  <p>@User.Identity.Name - <a asp-controller="Accounts" asp-action="Logout">Se déconnecter</a></p>
} else {
  <div>
    <a asp-controller="Accounts" asp-action="Register">Créer un compte</a>
    - <a asp-controller="Accounts" asp-action="Login">Se connecter</a>
  </div>
}