コード例 #1
0
        public async Task <IHttpActionResult> ChangeStateForArtifactAsync([FromUri] int artifactId, [FromBody] WorkflowStateChangeParameter stateChangeParameter)
        {
            // We assume that Session always exist as we have SessionRequired attribute
            if (artifactId <= 0 || stateChangeParameter == null || !ModelState.IsValid || stateChangeParameter.FromStateId == stateChangeParameter.ToStateId)
            {
                throw new BadRequestException("Please provide valid state change parameters");
            }

            return(Ok(await _workflowService.ChangeStateForArtifactAsync(Session.UserId, Session.UserName, artifactId, stateChangeParameter)));
        }