public async Task HandleAsync(MarkTaskAsDone command) { var task = await taskRepository.GetAsync(command.IssueId); var originalVersion = task.Version; await task.MarkAsDone(callContext.UserId, authorizationService); await taskRepository.Update(task, originalVersion); }
private void taskGrid_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e) { var selectedRow = taskGrid.CurrentRow; if (selectedRow == null) { return; } if (_gridUtils.TouchesColumn("Done", e.ColumnIndex, e.RowIndex)) { bool isTaskDone; if (Boolean.TryParse(selectedRow.Cells["Done"].Value.ToString(), out isTaskDone)) { var task = (TaskInGridView)(taskGrid.SelectedCells[0].OwningRow.DataBoundItem); TaskInGridView taskInGridView = _allTasks.First(x => x.Id == task.Id); if (isTaskDone) { var markTaskAsDone = new MarkTaskAsDone(task.Id); _commandDispatcher.Send(markTaskAsDone); // Fake in UI to increase user experience taskInGridView.IsDone = true; _allTasksInProject.Remove(taskInGridView); AddTaskToGridView(taskInGridView); int indexOfAddedTask = _allTasksInProject.IndexOf(taskInGridView); _gridUtils.FadeOut(indexOfAddedTask); } else { var reopenTask = new ReopenTask(task.Id); _commandDispatcher.Send(reopenTask); // Fake in UI to increase user experience taskInGridView.IsDone = false; _allTasksInProject.Remove(taskInGridView); AddTaskToGridView(taskInGridView); int indexOfAddedTask = _allTasksInProject.IndexOf(taskInGridView); _gridUtils.FadeIn(indexOfAddedTask); } } } }
public async Task <IActionResult> MarkAsDone([FromRoute] Guid projectId, [FromRoute] Guid taskId, [FromBody] MarkTaskAsDone command) { command.ProjectId = projectId; command.IssueId = taskId; await commandQueryBus.SendAsync(command); return(Ok()); }