public ActionResult Index() { var model = new ExchangeRateDTO(); using (CurrencyContext context = new CurrencyContext()) { model.ExchangeRateDataList = context.ExchangeRate.Where(m => m.Id > 0).Include(m => m.Currency).ToList(); } return(View(model)); }
private async Task GetRates() { try { ExchangeRateDTO eur = await Http.GetFromJsonAsync <ExchangeRateDTO>("latest?base=EUR&symbols=TRY"); ExchangeRateDTO usd = await Http.GetFromJsonAsync <ExchangeRateDTO>("latest?base=USD&symbols=TRY"); EUR = eur?.Rates?.Try; USD = usd?.Rates?.Try; } catch (System.Exception ex) { System.Console.WriteLine($"ERROR - {ex.Message}"); } }
public ExchangeRateDTO Insert(ExchangeRateDTO exchangeRate) { return(new ExchangeRateDTO());//todo }
[HttpPost("add")] public IActionResult Insert([FromBody] ExchangeRateDTO exchangeRate) => Json(_exchangeRateService.Insert(exchangeRate));