Ejemplo n.º 1
0
        public virtual async Task <IActionResult> SetCurrency(int customerCurrency, string returnUrl = "")
        {
            var currency = await _currencyService.GetCurrencyByIdAsync(customerCurrency);

            if (currency != null)
            {
                await _workContext.SetWorkingCurrencyAsync(currency);
            }

            //home page
            if (string.IsNullOrEmpty(returnUrl))
            {
                returnUrl = Url.RouteUrl("Homepage");
            }

            //prevent open redirection attack
            if (!Url.IsLocalUrl(returnUrl))
            {
                returnUrl = Url.RouteUrl("Homepage");
            }

            return(Redirect(returnUrl));
        }