Browse Source

Added 'Premium' badge to navbar if the user is a premium user.

master
Teknikode 2 weeks ago
parent
commit
c19601716c
1 changed files with 13 additions and 2 deletions
  1. 13
    2
      Teknik/Areas/User/Views/User/_LoginPartial.cshtml

+ 13
- 2
Teknik/Areas/User/Views/User/_LoginPartial.cshtml View File

@@ -1,8 +1,19 @@
@if (Config.UserConfig.RegistrationEnabled || Config.UserConfig.LoginEnabled)
{
<div class="nav navbar-nav navbar-right">
<ul class="nav navbar-nav navbar-right">
@if (User.Identity.IsAuthenticated)
{
var accountTypeString = User.FindFirst("account-type").Value;
if (!string.IsNullOrEmpty(accountTypeString))
{
if (Enum.TryParse(accountTypeString, out AccountType accountType) &&
accountType == AccountType.Premium)
{
<p class="navbar-text">
<span class="badge bg-primary">Premium</span>
</p>
}
}
<li class="dropdown">
<a href="#" id="user_menu" class="dropdown-toggle" data-toggle="dropdown">@User.Identity.Name <strong class="caret"></strong></a>
<ul class="dropdown-menu dropdown-left-manual" role="menu" aria-labelledby="user_menu">
@@ -49,5 +60,5 @@
<a href="@Url.SubRouteUrl("account", "User.Login", new { returnUrl = @Context.Request.GetDisplayUrl() })" class="btn btn-default navbar-btn">Log In</a>
}
}
</div>
</ul>
}

Loading…
Cancel
Save