using Microsoft.AspNetCore.Mvc; using economy.Models; using economy.Models.Financial; using Exchange = economy.Models.Financial.Exchange; using Interest = economy.Models.Financial.Interest; using International = economy.Models.Financial.International; namespace economy.Controllers { public class FinancialController : Controller { private readonly KoreaEximGoKR _koreaEximGoKR; private Dictionary _queryString; public FinancialController(KoreaEximGoKR koreaEximGoKR) { _koreaEximGoKR = koreaEximGoKR; } // 환율 public async Task Exchange(Exchange.Request request) { if (!ModelState.IsValid) { return BadRequest(ModelState); } FinancialModel exchange = new FinancialModel(_koreaEximGoKR); Exchange.Response itemList = await exchange.GetExchange(request); var viewModel = new View(); viewModel.Request = request; viewModel.Response = itemList; await exchange.GetExchangeValue(); return View(viewModel); } // 대출 금리 public async Task Interest(Interest.Request request) { if (!ModelState.IsValid) { return BadRequest(ModelState); } FinancialModel interest = new FinancialModel(_koreaEximGoKR); Interest.Response itemList = await interest.GetInterestRate(request); var viewModel = new View(); viewModel.Request = request; viewModel.Response = itemList; ViewData["type"] = "Interest"; return View(viewModel); } // 국제 금리 public async Task International(International.Request request) { if (!ModelState.IsValid) { return BadRequest(ModelState); } FinancialModel international = new FinancialModel(_koreaEximGoKR); International.Response itemList = await international.GetInternationalRate(request); var viewModel = new View(); viewModel.Request = request; viewModel.Response = itemList; ViewData["type"] = "International"; return View(viewModel); } } }