ildar-shaymukhametov_grandnode-refactorings/Grand.Web/Views/Shared/Components/CurrencySelector/Default.cshtml
@model CurrencySelectorModel
@inject IWebHelper webHelper
@if (Model.AvailableCurrencies.Count > 1)
{
    var returnUrl = webHelper.GetRawUrl(Context.Request);
    <div class="currency-selector d-block pr-1">
         @{   
             var currencies = Model.AvailableCurrencies.Select(x => new
             {
                 Name = x.Name,
                 Text = x.CurrencyCode,
                 Value = Url.RouteUrl("ChangeCurrency", new { customercurrency = x.Id, returnUrl }),
                 Selected = x.Id.Equals(Model.CurrentCurrencyId)
             });
            <div class="btn-group btn-group-sm float-xs-right">
                <button type="button" class="btn dropdown-toggle" data-toggle="dropdown">
                    @currencies.FirstOrDefault(x => x.Selected).Text
                    <span class="sr-only">Toggle Dropdown</span>
                    <span class="mdi mdi-chevron-down"></span>
                </button>
                <div class="dropdown-menu">
                    <ul class="pl-0 mb-0">
                        @foreach (var item in currencies)
                        {
                            var className = item.Selected ? "active" : "";
                            <li class="@className">
                                <a class="text-dark" href="@item.Value">@item.Text</a>
                            </li>
                        }
                    </ul>
                </div>
            </div>
        }
    </div>
}
