예제 #1
0
        public async Task <IActionResult> Get(string baseCurrency, string targetCurrency, decimal amount)
        {
            //Case sensetive input
            if (!InputCheck(baseCurrency, targetCurrency, amount))
            {
                return(BadRequest());
            }

            var result = await _service.Convert(baseCurrency, targetCurrency, amount);

            if (result == 0)
            {
                return(BadRequest());
            }

            return(Ok(result));
        }
예제 #2
0
        public async Task <IActionResult> GetRate(string baseCurrency, string targetCurrency, decimal amount, DateTime?date)
        {
            if (!InputCheck(baseCurrency, targetCurrency, amount))
            {
                return(BadRequest());
            }

            var result = await _service.Convert(baseCurrency, targetCurrency, amount, date);

            return(Ok(result));
        }