Ejemplo n.º 1
0
 public IActionResult Get(string code)
 {
     try
     {
         return(Ok(_exchangeService.GetExchange(code)));
     }
     catch (NotSupportedCurrencyException)
     {
         return(BadRequest());
     }
     catch (Exception)
     {
         return(StatusCode(500));
     }
 }
Ejemplo n.º 2
0
        private decimal CalcPurchaseAmount(Transaction transaction)
        {
            var currencyExchange = _exchangeService.GetExchange(transaction.CurrencyCode);

            return(Math.Round(transaction.Amount / currencyExchange.BuyingRate, 2));
        }