Esempio n. 1
0
        public async Task <CurrenciesRateApiModel> Get(string date)
        {
            try
            {
                var    allUrlKeyValues = ControllerContext.Request.GetQueryNameValuePairs();
                string baseCurrency    = allUrlKeyValues.LastOrDefault(x => x.Key == "base").Value;
                string quoteCurrency   = allUrlKeyValues.LastOrDefault(x => x.Key == "symbols").Value;

                CurrenciesRateApiModel model = await _dataProcessor.GetRateAsync(baseCurrency, quoteCurrency, date);

                return(model);
            }
            catch
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }
        }