public async Task <IActionResult> ExecuteTask([FromServices] ITaskComponentResolver taskComponentResolver, [FromServices] IXmlSerializerCache serializerCache, [FromServices] IExecuteTaskAction executeTaskAction) { var reader = new MazeTaskReader(Request.Body, taskComponentResolver, serializerCache); var task = reader.ReadTask(); var result = await executeTaskAction.BizActionAsync(task); return(BizActionStatus(executeTaskAction, () => Ok(result))); }
public async Task <IActionResult> CreateOrUpdateTask([FromServices] ITaskComponentResolver taskComponentResolver, [FromServices] IXmlSerializerCache serializerCache) { var mazeTask = new MazeTaskReader(Request.Body, taskComponentResolver, serializerCache); var task = mazeTask.ReadTask(); await _clientTaskManager.AddOrUpdateTask(task); return(Ok()); }
public static async Task <MazeTask> FetchTaskAsync(Guid taskId, ITaskComponentResolver taskComponentResolver, IXmlSerializerCache xmlSerializerCache, IRestClient restClient) { using (var response = await CreateRequest(HttpVerb.Get, taskId.ToString("N")).Execute(restClient)) using (var stream = await response.Content.ReadAsStreamAsync()) { var taskReader = new MazeTaskReader(stream, taskComponentResolver, xmlSerializerCache); return(taskReader.ReadTask()); } }
public async Task <IActionResult> CreateTask([FromServices] ITaskComponentResolver taskComponentResolver, [FromServices] IXmlSerializerCache serializerCache, [FromServices] ICreateTaskAction createTaskAction, [FromServices] IHubContext <AdministrationHub> hubContext) { var reader = new MazeTaskReader(Request.Body, taskComponentResolver, serializerCache); var task = reader.ReadTask(); await createTaskAction.BizActionAsync(task); return(await BizActionStatus(createTaskAction, async() => { await hubContext.Clients.All.SendAsync(HubEventNames.TaskCreated, task.Id); return Ok(); })); }
public async Task <IActionResult> ExecuteTask([FromServices] ITaskComponentResolver taskComponentResolver, [FromServices] IXmlSerializerCache serializerCache) { var mazeTask = new MazeTaskReader(Request.Body, taskComponentResolver, serializerCache); var task = mazeTask.ReadTask(); var memoryStorage = new MemoryTaskStorage(); await _clientTaskManager.TriggerNow(task, SessionKey.Create("Execute"), memoryStorage); return(Ok(new TaskSessionsInfo { Sessions = memoryStorage.Sessions.Select(x => new TaskSessionDto { TaskReferenceId = x.TaskReferenceId, TaskSessionId = x.TaskSessionId, Description = x.Description, CreatedOn = x.CreatedOn }).ToList(), Executions = memoryStorage.Executions.Select(x => new TaskExecutionDto { TaskExecutionId = x.TaskExecutionId, TaskReferenceId = x.TaskReferenceId, TaskSessionId = x.TaskSessionId, CreatedOn = x.CreatedOn }).ToList(), Results = memoryStorage.CommandResults.Select(x => new CommandResultDto { CommandResultId = x.CommandResultId, TaskExecutionId = x.TaskExecutionId, CommandName = x.CommandName, Result = x.Result, Status = x.Status, FinishedAt = x.FinishedAt }).ToList() })); }