Esempio n. 1
0
        public ActionResult New(string tabId, int parentId)
        {
            var workflow = _workflowService.NewWorkflowProperties(parentId);
            var model    = WorkflowViewModel.Create(workflow, tabId, parentId, _workflowService);

            return(JsonHtml("Properties", model));
        }
Esempio n. 2
0
        public ActionResult Properties(string tabId, int parentId, int id, string successfulActionCode)
        {
            var workflow = _workflowService.ReadProperties(id);
            var model    = WorkflowViewModel.Create(workflow, tabId, parentId, _workflowService);

            model.SuccesfulActionCode = successfulActionCode;
            return(JsonHtml("Properties", model));
        }
Esempio n. 3
0
        public async Task <ActionResult> New(string tabId, int parentId, IFormCollection collection)
        {
            var workflow = _workflowService.NewWorkflowPropertiesForUpdate(parentId);
            var model    = WorkflowViewModel.Create(workflow, tabId, parentId, _workflowService);

            await TryUpdateModelAsync(model);

            if (ModelState.IsValid)
            {
                model.Data = _workflowService.SaveWorkflowProperties(model.Data);
                PersistResultId(model.Data.Id);
                PersistRulesIds(null, model.Data.WorkflowRules.Select(n => n.Id).ToArray());
                return(Redirect("Properties", new { tabId, parentId, id = model.Data.Id, successfulActionCode = ActionCode.SaveWorkflow }));
            }

            return(await JsonHtml("Properties", model));
        }
Esempio n. 4
0
        public ActionResult Properties(string tabId, int parentId, int id, FormCollection collection)
        {
            var workflow = _workflowService.ReadPropertiesForUpdate(id);
            var model    = WorkflowViewModel.Create(workflow, tabId, parentId, _workflowService);

            TryUpdateModel(model);
            model.Validate(ModelState);
            if (ModelState.IsValid)
            {
                var oldIds = model.Data.WorkflowRules.Select(n => n.Id).ToArray();
                model.Data = _workflowService.UpdateProperties(model.Data, model.ActiveContentsIds);
                var newIds = model.Data.WorkflowRules.Select(n => n.Id).ToArray();
                PersistRulesIds(oldIds, newIds);
                return(Redirect("Properties", new { tabId, parentId, id = model.Data.Id, successfulActionCode = ActionCode.UpdateWorkflow }));
            }

            return(JsonHtml("Properties", model));
        }