Exemplo n.º 1
0
        public static SchemaDetailsDto FromSchemaWithDetails(ISchemaEntity schema, Resources resources)
        {
            var result = new SchemaDetailsDto();

            SimpleMapper.Map(schema, result);
            SimpleMapper.Map(schema.SchemaDef, result);
            SimpleMapper.Map(schema.SchemaDef.Scripts, result.Scripts);
            SimpleMapper.Map(schema.SchemaDef.Properties, result.Properties);

            result.FieldsInLists      = schema.SchemaDef.FieldsInLists.ToList();
            result.FieldsInReferences = schema.SchemaDef.FieldsInReferences.ToList();

            result.FieldRules = schema.SchemaDef.FieldRules.Select(FieldRuleDto.FromFieldRule).ToList();

            if (schema.SchemaDef.PreviewUrls.Count > 0)
            {
                result.PreviewUrls = new Dictionary <string, string>(schema.SchemaDef.PreviewUrls);
            }

            result.Fields = new List <FieldDto>();

            foreach (var field in schema.SchemaDef.Fields)
            {
                result.Fields.Add(FieldDto.FromField(field));
            }

            result.CreateLinks(resources);

            return(result);
        }
Exemplo n.º 2
0
        public static SchemaDetailsDto FromSchemaWithDetails(ISchemaEntity schema, ApiController controller, string app)
        {
            var result = new SchemaDetailsDto();

            SimpleMapper.Map(schema, result);
            SimpleMapper.Map(schema.SchemaDef, result);
            SimpleMapper.Map(schema.SchemaDef.Scripts, result.Scripts);
            SimpleMapper.Map(schema.SchemaDef.Properties, result.Properties);

            if (schema.SchemaDef.PreviewUrls.Count > 0)
            {
                result.PreviewUrls = new Dictionary <string, string>(schema.SchemaDef.PreviewUrls);
            }

            result.Fields = new List <FieldDto>();

            foreach (var field in schema.SchemaDef.Fields)
            {
                result.Fields.Add(FieldDto.FromField(field));
            }

            result.CreateLinks(controller, app);

            return(result);
        }