Esempio n. 1
0
        public BaseJsonResult SwitchCurrency(string currency)
        {
            if (!string.IsNullOrWhiteSpace(currency))
            {
                if (this.CurrentStorefront.IsSupportedCurrency(currency))
                {
                    StorefrontManager.SetCustomerCurrency(currency);
                    _pricingManager.CurrencyChosenPageEvent(this.CurrentStorefront, currency);
                    _cartManager.UpdateCartCurrency(this.CurrentStorefront, this.CurrentVisitorContext, currency);
                }
                else
                {
                    var json = new BaseJsonResult {
                        Success = false
                    };
                    json.Errors.Add(StorefrontManager.GetSystemMessage(StorefrontConstants.SystemMessages.InvalidCurrencyError));
                    return(json);
                }
            }

            return(new BaseJsonResult());
        }