Пример #1
0
        public async Task HandleAsync(AddBugToTask command)
        {
            var task = await taskRepository.GetAsync(command.TaskId);

            var originalVersion = task.Version;

            task.AddBug(taskFactory, command);
            var bug = task.Bugs.OrderBy(x => x.CreatedAt).Last();
            await taskRepository.UpdateChildEntity(task, originalVersion, bug);
        }
Пример #2
0
        public void AddBug(IIssueFactory issueFactory, AddBugToTask command)
        {
            if (Status == IssueStatus.Done)
            {
                throw new CannotAddChildIssueWhenParentIssueIsDone <Task, ChildBug>(Id);
            }

            var bug = System.Threading.Tasks.Task.Run(() => issueFactory.GenerateChildBug(command)).GetAwaiter().GetResult();

            Bugs.Add(bug);
            Update(new BugAddedToTask(bug.Id, Id, ProjectId, bug.Title, bug.Description, bug.ReporterId, bug.AssigneeId, bug.Labels.Select(x => x.Id).ToList(), bug.CreatedAt));
        }
        public async Task <IActionResult> AddToTask([FromRoute] Guid projectId, [FromRoute] Guid taskId, [FromBody] AddBugToTask command)
        {
            command.ProjectId = projectId;
            command.TaskId    = taskId;
            await commandQueryBus.SendAsync(command);

            return(Created("", command.CreatedId));
        }