@using System.Globalization
@using Grand.Business.Core.Extensions

@inject Grand.Business.Core.Interfaces.Common.Directory.ICurrencyService currencyService
@inject IWorkContext workContext

@{
    var availableCurrencies = (await currencyService.GetAllCurrencies(storeId: workContext.CurrentStore.Id))
    .Select(x =>
    {
//currency char
var currencySymbol = "";
        if (!string.IsNullOrEmpty(x.DisplayLocale))
            currencySymbol = new RegionInfo(x.DisplayLocale).CurrencySymbol;
        else
            currencySymbol = x.CurrencyCode;

//model
var currencyModel = new CurrencyModel
        {
            Id = x.Id,
            Name = x.GetTranslation(y => y.Name, workContext.WorkingLanguage.Id),
            CurrencyCode = x.CurrencyCode,
            CurrencySymbol = currencySymbol
        };
        return currencyModel;
    }).ToList();

    if (availableCurrencies.Count > 1)
    {
        var returnUrl = Context?.Request?.GetEncodedPathAndQuery();
        var currencies = availableCurrencies.Select(x => new
        {
            Name = x.Name,
            Text = x.CurrencyCode,
            Value = Url.RouteUrl("ChangeCurrency", new { currencyCode = x.CurrencyCode, returnUrl }),
            Selected = x.Id.Equals(workContext.WorkingCurrency.Id)
        });
        <b-dropdown class="mr-2" text="@currencies.FirstOrDefault(x => x.Selected).Text">
            @foreach (var item in currencies)
            {
                var className = item.Selected ? "active" : "";
                <b-dropdown-item class="@className" href="@item.Value">@item.Text</b-dropdown-item>
            }
        </b-dropdown>
    }
}