Exemple #1
0
        public HttpResponseMessage Post(Workflow workflow)
        {
            // set default value for user id
            if (workflow.OwnerID == 0)
            {
                workflow.OwnerID = 1;
            }
            if (workflow.WorkerID == 0)
            {
                workflow.WorkerID = 1;
            }

            if (repository.AddWorkflow(workflow))
            {
                DataSourceResult result = new DataSourceResult
                {
                    Data  = new[] { workflow },
                    Total = 1
                };

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, result);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = workflow.WorkflowID }));
                return(response);
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState));
            }
        }
Exemple #2
0
        private void CreateDirectPublishWorkflow(int portalId)
        {
            var workflow = new Entities.Workflow
            {
                WorkflowName = Localization.GetString("DefaultDirectPublishWorkflowName"),
                Description  = Localization.GetString("DefaultDirectPublishWorkflowDescription"),
                WorkflowKey  = DirectPublishWorkflowKey,
                IsSystem     = true,
                PortalID     = portalId
            };

            _workflowRepository.AddWorkflow(workflow);
            var publishedState = GetPublishedStateDefinition(1);

            publishedState.WorkflowID = workflow.WorkflowID;
            _workflowStateRepository.AddWorkflowState(publishedState);
        }
Exemple #3
0
 public async Task <ActionResult> AddProjectMilestone(Workflow model)
 {
     if (ModelState.IsValid)
     {
         return(Ok(await _repository.AddWorkflow(model)));
     }
     return(BadRequest());
 }
Exemple #4
0
        public void AddWorkflow(Entities.Workflow workflow)
        {
            _workflowRepository.AddWorkflow(workflow);

            var firstDefaultState = _systemWorkflowManager.GetDraftStateDefinition(1);
            var lastDefaultState  = _systemWorkflowManager.GetPublishedStateDefinition(2);

            firstDefaultState.WorkflowID = workflow.WorkflowID;
            lastDefaultState.WorkflowID  = workflow.WorkflowID;

            _workflowStateRepository.AddWorkflowState(firstDefaultState);
            _workflowStateRepository.AddWorkflowState(lastDefaultState);

            workflow.States = new List <WorkflowState>
            {
                firstDefaultState,
                lastDefaultState
            };
        }