public IActionResult RetrieveExchangeRateList(string Currency)
        {
            var result = _exchange_rate_service.RetrieveExchangeRateListing();

            // Using ModelState to help validate the input from the end user
            if (!string.IsNullOrEmpty(Currency))
            {
                result = _exchange_rate_service.RetrieveExchangeRateListing().Where(x => x.Currency == Currency).ToList();
                if (result != null)
                {
                    return(Ok(new Resp(HttpStatusCode.OK, 0, result)));
                }
                else
                {
                    return(Ok(new Resp(HttpStatusCode.BadRequest, Models_General.ERR_SERVER_BUSY_INTERNAL_ERROR)));
                }
            }
            else
            {
                if (result != null)
                {
                    return(Ok(new Resp(HttpStatusCode.OK, 0, result)));
                }
                else
                {
                    return(Ok(new Resp(HttpStatusCode.BadRequest, Models_General.ERR_SERVER_BUSY_INTERNAL_ERROR)));
                }
            }
        }
예제 #2
0
        public IActionResult RetrieveExchangeRateListing()
        {
            var result = _exchange_rate_service.RetrieveExchangeRateListing();

            if (result != null)
            {
                return(Ok(new Resp(HttpStatusCode.OK, 0, result)));
            }
            else
            {
                return(Ok(new Resp(HttpStatusCode.BadRequest, Models_General.ERR_SERVER_BUSY_INTERNAL_ERROR)));
            }
        }