Beispiel #1
0
        public async Task <IActionResult> Edit(string activityName, [FromBody] JToken json, CancellationToken cancellationToken)
        {
            var activityDescriptor = await activityLibrary.GetByNameAsync(activityName, cancellationToken);

            var activity    = activityDescriptor.InstantiateActivity(json);
            var editorShape = await displayManager.BuildEditorAsync(activity, this, false);

            var model = new ActivityEditorEditViewModel
            {
                ActivityJson        = json.ToString(),
                ActivityEditorShape = editorShape,
            };

            return(View(model));
        }
Beispiel #2
0
        public async Task <IActionResult> Create(string activityName, [FromBody] JToken json, CancellationToken cancellationToken)
        {
            var activityDescriptor = await activityLibrary.GetByNameAsync(activityName, cancellationToken);

            var activity = activityDescriptor.InstantiateActivity(json);

            activity.Id = Guid.NewGuid().ToString().Replace("-", "");

            var editorShape = await displayManager.BuildEditorAsync(activity, this, false);

            var activityToken = await workflowTokenizer.TokenizeActivityAsync(activity, cancellationToken);

            var model = new ActivityEditorEditViewModel
            {
                ActivityJson        = activityToken.ToString(),
                ActivityEditorShape = editorShape,
            };

            return(View("Edit", model));
        }