Example #1
0
        public static AssetsDto FromAssets(IResultList <IEnrichedAssetEntity> assets, Resources resources)
        {
            var response = new AssetsDto
            {
                Total = assets.Total,
                Items = assets.Select(x => AssetDto.FromAsset(x, resources)).ToArray()
            };

            return(CreateLinks(response, resources));
        }
Example #2
0
        public static RuleEventsDto FromRuleEvents(IResultList <IRuleEventEntity> ruleEvents, Resources resources)
        {
            var result = new RuleEventsDto
            {
                Total = ruleEvents.Total,
                Items = ruleEvents.Select(x => RuleEventDto.FromRuleEvent(x, resources)).ToArray()
            };

            return(result.CreateLinks(resources));
        }
Example #3
0
        public static RuleEventsDto FromRuleEvents(IResultList <IRuleEventEntity> ruleEvents, ApiController controller, string app)
        {
            var result = new RuleEventsDto
            {
                Total = ruleEvents.Total,
                Items = ruleEvents.Select(x => RuleEventDto.FromRuleEvent(x, controller, app)).ToArray()
            };

            return(result.CreateLinks(controller, app));
        }
Example #4
0
        public static AssetsDto FromAssets(IResultList <IEnrichedAssetEntity> assets, ApiController controller, string app)
        {
            var response = new AssetsDto
            {
                Total = assets.Total,
                Items = assets.Select(x => AssetDto.FromAsset(x, controller, app)).ToArray()
            };

            return(CreateLinks(response, controller, app));
        }
Example #5
0
        public static AssetFoldersDto FromAssets(IResultList <IAssetFolderEntity> assetFolders, IEnumerable <IAssetFolderEntity> path, Resources resources)
        {
            var response = new AssetFoldersDto
            {
                Total = assetFolders.Total,
                Items = assetFolders.Select(x => AssetFolderDto.FromAssetFolder(x, resources)).ToArray()
            };

            response.Path = path.Select(x => AssetFolderDto.FromAssetFolder(x, resources)).ToArray();

            return(CreateLinks(response, resources));
        }
Example #6
0
        public static async Task <ContentsDto> FromContentsAsync(IResultList <IEnrichedContentEntity> contents, Context context, ApiController controller, ISchemaEntity schema, IContentWorkflow workflow)
        {
            var result = new ContentsDto
            {
                Total = contents.Total,
                Items = contents.Select(x => ContentDto.FromContent(context, x, controller)).ToArray()
            };

            await result.AssignStatusesAsync(workflow, schema);

            return(result.CreateLinks(controller, schema.AppId.Name, schema.SchemaDef.Name));
        }
Example #7
0
        public static async Task <ContentsDto> FromContentsAsync(IResultList <IEnrichedContentEntity> contents, Resources resources,
                                                                 ISchemaEntity?schema, IContentWorkflow workflow)
        {
            var result = new ContentsDto
            {
                Total = contents.Total,
                Items = contents.Select(x => ContentDto.FromContent(x, resources)).ToArray()
            };

            if (schema != null)
            {
                await result.AssignStatusesAsync(workflow, schema);

                result.CreateLinks(resources, schema.SchemaDef.Name);
            }

            return(result);
        }
Example #8
0
 public static AssetsDto FromAssets(IResultList <IAssetEntity> assets)
 {
     return(new AssetsDto {
         Total = assets.Total, Items = assets.Select(AssetDto.FromAsset).ToArray()
     });
 }