You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
909 B
36 lines
909 B
using Kean.Domain.Task.Commands;
|
|
using Kean.Domain.Task.Repositories;
|
|
|
|
namespace Kean.Domain.Task.SharedServices
|
|
{
|
|
/// <summary>
|
|
/// 任务取消
|
|
/// </summary>
|
|
public sealed class DeleteTask
|
|
{
|
|
private readonly ITaskRepository _taskRepository; // 任务仓库
|
|
|
|
/// <summary>
|
|
/// 依赖注入
|
|
/// </summary>
|
|
public DeleteTask(ITaskRepository taskRepository)
|
|
{
|
|
_taskRepository = taskRepository;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 处理程序
|
|
/// </summary>
|
|
/// <param name="id">标识</param>
|
|
public async System.Threading.Tasks.Task Handler(string barcode)
|
|
{
|
|
var task = await _taskRepository.GetTaskByBarcode(barcode);
|
|
if (task != null && task.Id > 0)
|
|
{
|
|
await _taskRepository.DeleteTask(task.Id);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|