Esempio n. 1
0
        public static async Task <WorkflowsDto> FromAppAsync(IWorkflowsValidator workflowsValidator, IAppEntity app, ApiController controller)
        {
            var result = new WorkflowsDto
            {
                Items = app.Workflows.Select(x => WorkflowDto.FromWorkflow(x.Key, x.Value, controller, app.Name)).ToArray(),
            };

            var errors = await workflowsValidator.ValidateAsync(app.Id, app.Workflows);

            result.Errors = errors.ToArray();

            return(result.CreateLinks(controller, app.Name));
        }
Esempio n. 2
0
        public static async Task <WorkflowsDto> FromAppAsync(IWorkflowsValidator workflowsValidator, IAppEntity app, Resources resources)
        {
            var result = new WorkflowsDto
            {
                Items =
                    app.Workflows
                    .Select(x => WorkflowDto.FromDomain(x.Key, x.Value))
                    .Select(x => x.CreateLinks(resources))
                    .ToArray()
            };

            var errors = await workflowsValidator.ValidateAsync(app.Id, app.Workflows);

            result.Errors = errors.ToArray();

            return(result.CreateLinks(resources));
        }