public async Task <ActionResult <List <WorkflowStep_WorkflowStepDTO> > > List([FromBody] WorkflowStep_WorkflowStepFilterDTO WorkflowStep_WorkflowStepFilterDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            WorkflowStepFilter WorkflowStepFilter = ConvertFilterDTOToFilterEntity(WorkflowStep_WorkflowStepFilterDTO);

            WorkflowStepFilter = WorkflowStepService.ToFilter(WorkflowStepFilter);
            List <WorkflowStep> WorkflowSteps = await WorkflowStepService.List(WorkflowStepFilter);

            List <WorkflowStep_WorkflowStepDTO> WorkflowStep_WorkflowStepDTOs = WorkflowSteps
                                                                                .Select(c => new WorkflowStep_WorkflowStepDTO(c)).ToList();

            return(WorkflowStep_WorkflowStepDTOs);
        }
        public async Task <FileResult> Export([FromBody] WorkflowDirection_WorkflowDirectionFilterDTO WorkflowDirection_WorkflowDirectionFilterDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            MemoryStream memoryStream = new MemoryStream();

            using (ExcelPackage excel = new ExcelPackage(memoryStream))
            {
                #region WorkflowDirection
                var WorkflowDirectionFilter = ConvertFilterDTOToFilterEntity(WorkflowDirection_WorkflowDirectionFilterDTO);
                WorkflowDirectionFilter.Skip = 0;
                WorkflowDirectionFilter.Take = int.MaxValue;
                WorkflowDirectionFilter      = WorkflowDirectionService.ToFilter(WorkflowDirectionFilter);
                List <WorkflowDirection> WorkflowDirections = await WorkflowDirectionService.List(WorkflowDirectionFilter);

                var WorkflowDirectionHeaders = new List <string[]>()
                {
                    new string[] {
                        "Id",
                        "WorkflowDefinitionId",
                        "FromStepId",
                        "ToStepId",
                        "SubjectMailForCreator",
                        "SubjectMailForNextStep",
                        "BodyMailForCreator",
                        "BodyMailForNextStep",
                    }
                };
                List <object[]> WorkflowDirectionData = new List <object[]>();
                for (int i = 0; i < WorkflowDirections.Count; i++)
                {
                    var WorkflowDirection = WorkflowDirections[i];
                    WorkflowDirectionData.Add(new Object[]
                    {
                        WorkflowDirection.Id,
                        WorkflowDirection.WorkflowDefinitionId,
                        WorkflowDirection.FromStepId,
                        WorkflowDirection.ToStepId,
                        WorkflowDirection.SubjectMailForCreator,
                        WorkflowDirection.SubjectMailForNextStep,
                        WorkflowDirection.BodyMailForCreator,
                        WorkflowDirection.BodyMailForNextStep,
                    });
                }
                excel.GenerateWorksheet("WorkflowDirection", WorkflowDirectionHeaders, WorkflowDirectionData);
                #endregion

                #region WorkflowStep
                var WorkflowStepFilter = new WorkflowStepFilter();
                WorkflowStepFilter.Selects   = WorkflowStepSelect.ALL;
                WorkflowStepFilter.OrderBy   = WorkflowStepOrder.Id;
                WorkflowStepFilter.OrderType = OrderType.ASC;
                WorkflowStepFilter.Skip      = 0;
                WorkflowStepFilter.Take      = int.MaxValue;
                List <WorkflowStep> WorkflowSteps = await WorkflowStepService.List(WorkflowStepFilter);

                var WorkflowStepHeaders = new List <string[]>()
                {
                    new string[] {
                        "Id",
                        "WorkflowDefinitionId",
                        "Name",
                        "RoleId",
                        "SubjectMailForReject",
                        "BodyMailForReject",
                    }
                };
                List <object[]> WorkflowStepData = new List <object[]>();
                for (int i = 0; i < WorkflowSteps.Count; i++)
                {
                    var WorkflowStep = WorkflowSteps[i];
                    WorkflowStepData.Add(new Object[]
                    {
                        WorkflowStep.Id,
                        WorkflowStep.WorkflowDefinitionId,
                        WorkflowStep.Name,
                        WorkflowStep.RoleId,
                        WorkflowStep.SubjectMailForReject,
                        WorkflowStep.BodyMailForReject,
                    });
                }
                excel.GenerateWorksheet("WorkflowStep", WorkflowStepHeaders, WorkflowStepData);
                #endregion
                #region WorkflowDefinition
                var WorkflowDefinitionFilter = new WorkflowDefinitionFilter();
                WorkflowDefinitionFilter.Selects   = WorkflowDefinitionSelect.ALL;
                WorkflowDefinitionFilter.OrderBy   = WorkflowDefinitionOrder.Id;
                WorkflowDefinitionFilter.OrderType = OrderType.ASC;
                WorkflowDefinitionFilter.Skip      = 0;
                WorkflowDefinitionFilter.Take      = int.MaxValue;
                List <WorkflowDefinition> WorkflowDefinitions = await WorkflowDefinitionService.List(WorkflowDefinitionFilter);

                var WorkflowDefinitionHeaders = new List <string[]>()
                {
                    new string[] {
                        "Id",
                        "Name",
                        "WorkflowTypeId",
                        "StartDate",
                        "EndDate",
                        "StatusId",
                    }
                };
                List <object[]> WorkflowDefinitionData = new List <object[]>();
                for (int i = 0; i < WorkflowDefinitions.Count; i++)
                {
                    var WorkflowDefinition = WorkflowDefinitions[i];
                    WorkflowDefinitionData.Add(new Object[]
                    {
                        WorkflowDefinition.Id,
                        WorkflowDefinition.Name,
                        WorkflowDefinition.WorkflowTypeId,
                        WorkflowDefinition.StartDate,
                        WorkflowDefinition.EndDate,
                        WorkflowDefinition.StatusId,
                    });
                }
                excel.GenerateWorksheet("WorkflowDefinition", WorkflowDefinitionHeaders, WorkflowDefinitionData);
                #endregion
                excel.Save();
            }
            return(File(memoryStream.ToArray(), "application/octet-stream", "WorkflowDirection.xlsx"));
        }