Example #1
0
        public static string FormatPrice(this ILocalizationProvider localizationProvider, decimal price, string currencyCode)
        {
            if (localizationProvider == null)
            {
                throw new ArgumentNullException(nameof(localizationProvider));
            }
            if (currencyCode == null)
            {
                throw new ArgumentNullException(nameof(currencyCode));
            }


            if (!ISOCurrenciesToACultureMap.TryGetValue(currencyCode, out CultureInfo cultureInfo))
            {
                throw new InvalidOperationException($"Not supported currency code: '{currencyCode}'");
            }

            return(localizationProvider.FormatPrice(price, cultureInfo));
        }