You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.8 KiB
C#

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
{
/// <summary>
/// 邮件模板API
/// </summary>
public class TaskMailController : ApiController
{
readonly ITaskMailService service;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="service"></param>
public TaskMailController(ITaskMailService service)
{
this.service = service;
}
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("GetList")]
public async Task<DataResult<List<BusinessTaskMail>>> GetListAsync(PageRequest request)
{
return await service.GetListAsync(request);
}
/// <summary>
/// 详情
/// </summary>
/// <param name="id">ID</param>
/// <returns></returns>
[HttpGet, Route("Edit")]
public async Task<DataResult<BusinessTaskMail>> GetAsync(long id)
{
return await service.GetAsync(id);
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="taskMail">邮件配置</param>
/// <returns></returns>
[HttpPost, Route("Edit")]
public async Task<DataResult> 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);
}
}
}