public async Task <TaskReference> BizActionAsync(MazeTask inputData) { if (ValidateModelFailed(inputData)) { return(null); } var taskReference = await _dbAccess.FindAsync(inputData.Id); if (taskReference != null) { return(ReturnError <TaskReference>(TaskErrors.TaskAlreadyExists)); } await _taskDirectory.WriteTask(inputData); taskReference = new TaskReference { TaskId = inputData.Id, IsCompleted = false, IsEnabled = true, AddedOn = DateTimeOffset.UtcNow }; await _dbAccess.CreateAsync(taskReference); var hash = _taskDirectory.ComputeTaskHash(inputData); await _management.InitializeTask(inputData, hash, transmit : true, executeLocally : true); return(taskReference); }
public async Task BizActionAsync(MazeTask inputData) { if (ValidateModelFailed(inputData)) { return; } var taskReference = await _dbAccess.FindAsync(inputData.Id); if (taskReference == null) { AddValidationResult(TaskErrors.TaskNotFound); return; } await _taskDirectory.WriteTask(inputData); if (taskReference.IsEnabled) { var hash = _taskDirectory.ComputeTaskHash(inputData); await _management.CancelTask(inputData.Id); await _management.InitializeTask(inputData, hash, transmit : true, executeLocally : true); } }