Esempio n. 1
0
        public async Task <WorkflowStatus> ProcessAuditorApproval(
            [ActivityTrigger] DurableActivityContext context,
            ILogger log)
        {
            var data = context.GetInput <ProcessAuditorApprovalData>();

            if (data.ApprovalEventData.Result)
            {
                await _approvalService.Approve(data.WorkflowId, data.ApprovalEventData.Auditor);
            }
            else
            {
                await _approvalService.Deny(data.WorkflowId, data.ApprovalEventData.Auditor);
            }

            if (await _approvalService.IsParticipantInWaitingState(data.WorkflowId))
            {
                return(WorkflowStatus.InApproval);
            }

            await _approvalService.SetStatus(data.WorkflowId, WorkflowStatus.ApprovalCompleted);

            return(WorkflowStatus.ApprovalCompleted);
        }