public decimal ConvertCurrency(string @from, string to, decimal belopp)
        {
            var result = 0m;

            Polly.Policy.HandleResult <decimal>(r => r == 0)
            .Retry(_settings.Retries, onRetry: (result, i) => System.Threading.Thread.Sleep(i * 10000 + 5000)).Execute(() =>
            {
                result = _inner.ConvertCurrency(from, to, belopp);
                return(result);
            });
            return(result);
        }
Exemplo n.º 2
0
        public IActionResult Index(ShowCurrencyConverterViewModel model)
        {
            //if ((model.Tal % 2) == 0)
            //{
            //    ModelState.AddModelError("Tal", "Måste vara ijmt");
            //}

            if (ModelState.IsValid)
            {
                model.Result = _currentCalculator.ConvertCurrency(model.FromCurrency, model.ToCurrency, model.Belopp);
            }
            model.AllCurrencies = GetAllCurrencies();
            return(View(model));
        }
 public decimal ConvertCurrency(string @from, string to, decimal belopp)
 {
     return(_inner.ConvertCurrency(from, to, belopp));
 }