Exemplo n.º 1
0
        public APIResponseMessage CurrencyConversion([FromBody] CurrencyConversionDomainModel model)
        {
            HttpStatusCode statusCode = HttpStatusCode.OK;
            string         message    = string.Empty;
            dynamic        result     = null;

            try
            {
                result = _fixerService.CurrencyConversion(model);
            }
            catch (Exception ex)
            {
                APIHelper.GetErrorAPIResponseMessage(ref ex, ref statusCode, ref message);
            }
            return(APIHelper.CreateAPIResponseMessage(statusCode, message, result));
        }
Exemplo n.º 2
0
        public CurrencyConversionDomainModel CurrencyConversion(CurrencyConversionDomainModel model)
        {
            CurrencyConversionDomainModel result = default;

            try
            {
                var exchangedAmount = CurrencyConversion(model.FirstCurrencyCode, model.SecondCurrencyCode, model.CurrencyAmount, model.ExchangeDate);
                result = result ?? new CurrencyConversionDomainModel();
                result.FirstCurrencyCode  = model.FirstCurrencyCode.ToUpper();
                result.CurrencyAmount     = model.CurrencyAmount;
                result.SecondCurrencyCode = model.SecondCurrencyCode.ToUpper();
                result.ExchangedAmount    = exchangedAmount;
                result.ExchangeDate       = model.ExchangeDate;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }