public IActionResult Get(string code) { try { return(Ok(_exchangeService.GetExchange(code))); } catch (NotSupportedCurrencyException) { return(BadRequest()); } catch (Exception) { return(StatusCode(500)); } }
private decimal CalcPurchaseAmount(Transaction transaction) { var currencyExchange = _exchangeService.GetExchange(transaction.CurrencyCode); return(Math.Round(transaction.Amount / currencyExchange.BuyingRate, 2)); }