Beispiel #1
0
        //[ValidateAntiForgeryToken]
        public IActionResult CreateBusinessFlow([FromBody] CreateWorkFlowModel model)
        {
            if (model.StepData.IsEmpty())
            {
                ModelState.AddModelError("", T["workflow_step_empty"]);
            }
            List <ProcessStage> steps = new List <ProcessStage>();

            steps = steps.DeserializeFromJson(model.StepData.UrlDecode());
            if (steps.IsEmpty())
            {
                ModelState.AddModelError("", T["workflow_step_empty"]);
            }
            if (ModelState.IsValid)
            {
                var entity = new WorkFlow();
                model.CopyTo(entity);
                entity.WorkFlowId = Guid.NewGuid();
                entity.Category   = 2;
                entity.CreatedBy  = CurrentUser.SystemUserId;
                entity.CreatedOn  = DateTime.Now;
                entity.StateCode  = Core.RecordState.Enabled;
                entity.SolutionId = SolutionId.Value;
                foreach (var item in steps)
                {
                    item.ProcessStageId = Guid.NewGuid();
                    item.WorkFlowId     = entity.WorkFlowId;
                }

                _workFlowCreater.Create(entity);
                _processStageService.CreateMany(steps);
                return(CreateSuccess(new { id = entity.WorkFlowId }));
            }
            return(CreateFailure(GetModelErrors()));
        }
Beispiel #2
0
        public IActionResult CreateWorkFlow()
        {
            CreateWorkFlowModel model = new CreateWorkFlowModel
            {
                SolutionId = SolutionId.Value
            };

            return(View(model));
        }