public async Task <IActionResult> Create([FromBody] JToken workflowData, CancellationToken cancellationToken) { var workflow = await workflowSerializer.DeserializeAsync(workflowData, cancellationToken); await workflowStore.AddAsync(workflow, cancellationToken); return(Json(new { redirect = Url.Action("Edit", new { id = workflow.Metadata.Id }) })); }
private async Task <Workflow> LoadWorkflowDefinitionAsync(string path, CancellationToken cancellationToken) { var data = fileSystem.File.ReadAllText(path); var workflow = await workflowSerializer.DeserializeAsync(data, format, cancellationToken); workflow.Metadata.Id = fileSystem.Path.GetFileName(path); return(workflow); }
private async Task <Workflow> LoadWorkflowDefinitionAsync(IFileStoreEntry file, CancellationToken cancellationToken) { var data = await fileStore.ReadToEndAsync(file.Path); var workflow = await workflowSerializer.DeserializeAsync(data, Format, cancellationToken); workflow.Metadata.Id = file.Name; return(workflow); }