Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
@inject IThemeContextFactory ThemeContext
@inject IEnumerable<IThemeView> Themes
@{
var themeContext = ThemeContext.GetThemeContext("");
var availablThemes = Themes.Where(x => x.AreaName == "").ToList()
.Select(x => new StoreThemeModel
{
Name = x.ThemeName,
Title = x.ThemeInfo?.Title
}).ToList();
var returnurl = Context?.Request?.GetEncodedPathAndQuery();
if (availablThemes.Count > 1)
{
var currentTheme = availablThemes.FirstOrDefault(x => x.Name == themeContext?.GetCurrentTheme());
@*a bare theme name next to "USD" and "English" reads as neither: the icon
and the label say what this dropdown changes*@
<div class="dropdown btn-group me-2">
<button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" title="@Loc["StoreTheme"]">
<i class="b-icon bi bi-palette me-1" aria-hidden="true"></i>
<span class="visually-hidden">@Loc["StoreTheme"]</span>
@(currentTheme?.Title ?? currentTheme?.Name ?? themeContext?.GetCurrentTheme())
</button>
<ul class="dropdown-menu">
@foreach (var theme in availablThemes)
{
var className = theme.Name == themeContext?.GetCurrentTheme() ? "active" : "";
<li><a class="dropdown-item @className" href="@Url.Action("SetStoreTheme", "Common", new { themename = theme.Name, returnUrl = returnurl })">
@(theme.Title ?? theme.Name)
</a></li>
}
</ul>
</div>
}
}