using DS.Module.Core;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Interface;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.FeeApi.Controllers
{
///
/// 汇率设置服务
///
public class FeeCurrencyExchangeController : ApiController
{
private readonly IFeeCurrencyExchangeService _invokeService;
///
/// 构造函数
///
///
public FeeCurrencyExchangeController(IFeeCurrencyExchangeService invokeService)
{
_invokeService = invokeService;
}
///
/// 列表
///
///
///
[HttpPost]
[Route("GetFeeCurrencyExchangeList")]
public DataResult> GetFeeCurrencyExchangeList([FromBody] PageRequest request)
{
var res = _invokeService.GetListByPage(request);
return res;
}
///
/// 编辑
///
///
///
[HttpPost]
[Route("EditFeeCurrencyExchange")]
public DataResult EditFeeCurrencyExchange([FromBody] FeeCurrencyExchangeReq model)
{
var res = _invokeService.EditFeeCurrencyExchange(model);
return res;
}
///
/// 详情
///
///
///
[HttpGet]
[Route("GetFeeCurrencyExchangeInfo")]
public DataResult GetFeeCurrencyExchangeInfo([FromQuery] string id)
{
var res = _invokeService.GetFeeCurrencyExchangeInfo(id);
return res;
}
///
/// 获取两种币别之间的汇率
///
/// 原币别
/// 目标币别
/// 费用类型
///
[HttpGet, Route("GetExchangeRate")]
public async Task> GetExchangeRateAsync([FromQuery] string currencyFrom, [FromQuery] string currencyTo, [FromQuery] FeeType? feeType)
{
return await _invokeService.GetExchangeRateAsync(new ExchangeRate
{
CurrencyFrom = currencyFrom,
CurrencyTo = currencyTo,
FeeType = feeType
});
}
}
}