public void Add(AbortTaskDto model) { var task = new AbortTask(model.Name, model.Content); this._abortTaskRepository.Add(task); this._unitOfWork.Commit(); }
public void Handle(AbortTask message) { Data.Abort(message.UserId); messageBus.Publish <TaskWasAborted>(m => { m.TaskId = message.TaskId; m.AbortedBy = message.UserId; }); }
public void Translate(TranslateDto model) { //AbortTask task = this._validateTranslateDomianService.Validate(model.FromId, model.ToId, model.TaskId); //task.Translate(model.FromId, model.ToId); AbortTask task = this._abortTaskRepository.Find(model.TaskId); if (task == null) { throw new Exception("指定的任务不存在!"); } Account from = this._accountRepository.Find(model.FromId); Account to = this._accountRepository.Find(model.ToId); task.Translate(from, to); // 这个实体中一定要有主键 this._abortTaskRepository.Update(task, t => t.From, t => t.To); this._unitOfWork.Commit(); }
public AbortTask Validate(int from, int to, int task) { AbortTask @default = this._abortTaskRepository.Find(task); if (@default == null) { throw new Exception($"ID {task} 指定的任务不存在!"); } Account fa = this._accountRepository.Find(from); if (fa == null) { throw new Exception($"ID {from} 该账号不存在!"); } Account ta = this._accountRepository.Find(from); if (ta == null) { throw new Exception($"ID {to} 该账号不存在!"); } return(@default); }