-
Notifications
You must be signed in to change notification settings - Fork 585
Expand file tree
/
Copy pathExchangeRateController.cs
More file actions
40 lines (36 loc) · 1.11 KB
/
ExchangeRateController.cs
File metadata and controls
40 lines (36 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using ExchangeRateAPI.Adapters;
using ExchangeRateAPI.Models;
using ExchangeRateUpdater.Business;
using Microsoft.AspNetCore.Mvc;
namespace ExchangeRateAPI.Controllers
{
[ApiController]
[Route("[controller]")]
public class ExchangeRateController : ControllerBase
{
private readonly IExchangeRateProvider __ExchangeRateProvider;
private readonly List<string> __Currencies =
[
"AUD",
"USD",
"EUR",
"CZK",
"JPY",
"KES",
"RUB",
"THB",
"TRY",
"XYZ"
];
public ExchangeRateController(IExchangeRateProvider exchangeRateProvider)
{
__ExchangeRateProvider = exchangeRateProvider;
}
[HttpGet(Name = "GetExchangeRates")]
public async Task<List<ExchangeRateResponse>> GetAsync()
{
List<ExchangeRateResponse> _Response = (await __ExchangeRateProvider.GetExchangeRatesAsync(ExchangeRateAdapter.ConvertToCurrencyList(__Currencies))).ToExchangeRateResponses();
return _Response;
}
}
}