using DS.Module.Core;
using DS.WMS.Core.Op.Entity.TaskInteraction;
using DS.WMS.Core.Op.Interface.TaskInteraction;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.OpApi.Controllers
{
///
/// 任务邮件API
///
public class TaskMailController : ApiController
{
readonly ITaskMailService service;
///
/// 构造函数
///
///
public TaskMailController(ITaskMailService service)
{
this.service = service;
}
///
/// 获取分页列表
///
///
///
[HttpPost, Route("GetList")]
public async Task>> GetListAsync(PageRequest request)
{
return await service.GetListAsync(request);
}
///
/// 详情
///
/// ID
///
[HttpGet, Route("Edit")]
public async Task> GetAsync(long id)
{
return await service.GetAsync(id);
}
///
/// 编辑
///
/// 邮件配置
///
[HttpPost, Route("Edit")]
public async Task EditAsync(BusinessTaskMail taskMail)
{
if (taskMail.Receiver == null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskMailReceiverNotNull));
if (taskMail.Sender == null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskMailSenderNotNull));
return await service.EditAsync(taskMail);
}
}
}