12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using Microsoft.AspNetCore.Mvc;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using XYY.Common.Standard;
- using XYY.Core.Standard.Mvc;
- using XYY.Service.Standard.Finance;
- namespace XYY.Api.Finance.Controllers
- {
- [Route("api/[controller]/[action]")]
- [ApiController]
- public class EUExchangeRateController : ApiControllerBase
- {
- public class RateDto
- {
- public DateTime StartTime { get; set; }
- public DateTime EndTime { get; set; }
- public byte[] file
- {
- get
- {
- return new System.Net.WebClient().DownloadData(Url);
- }
- }
- public int Id { get; set; }
- public string Url
- {
- get; set;
- }
- }
- IEUExchangeRateService EUExchangeRateService;
- public EUExchangeRateController(IEUExchangeRateService eUExchangeRateService)
- {
- EUExchangeRateService = eUExchangeRateService;
- }
- public async Task<IActionResult> AddEUExchangeRate(RateDto dto)
- {
- await EUExchangeRateService.AddEUExchangeRate(dto.StartTime, dto.EndTime, dto.file);
- return Ok();
- }
- public async Task<IActionResult> ChangeEUExchangeRate(RateDto dto)
- {
- await EUExchangeRateService.ChangeEUExchangeRate(new Model.Standard.Finance.Finance_EUExchangeRate { Id = dto.Id, StartTime = dto.StartTime, EndTime = dto.EndTime });
- return Ok();
- }
- public async Task<IActionResult> ChangeEUExchangeDetail(RateDto dto)
- {
- await EUExchangeRateService.ChangeEUExchangeDetail(dto.Id, dto.file);
- return Ok();
- }
- public async Task<IActionResult> GetPageResult(QueryModel queryModel)
- {
- var result = await EUExchangeRateService.GetPageResult(queryModel);
- return Ok(result);
- }
- public async Task<IActionResult> GetList(int Id)
- {
- var result = await EUExchangeRateService.GetList(Id);
- return Ok(result);
- }
- }
- }
|