예제 #1
0
        public static AssetFoldersDto FromAssets(IResultList <IAssetFolderEntity> assetFolders, Resources resources)
        {
            var response = new AssetFoldersDto
            {
                Total = assetFolders.Total,
                Items = assetFolders.Select(x => AssetFolderDto.FromAssetFolder(x, resources)).ToArray()
            };

            return(CreateLinks(response, resources));
        }
예제 #2
0
        public static AssetFoldersDto FromAssets(IResultList <IAssetFolderEntity> assetFolders, ApiController controller, string app)
        {
            var response = new AssetFoldersDto
            {
                Total = assetFolders.Total,
                Items = assetFolders.Select(x => AssetFolderDto.FromAssetFolder(x, controller, app)).ToArray()
            };

            return(CreateLinks(response, controller, app));
        }
예제 #3
0
        public static AssetFoldersDto FromDomain(IResultList <IAssetFolderEntity> assetFolders, IEnumerable <IAssetFolderEntity> path, Resources resources)
        {
            var result = new AssetFoldersDto
            {
                Total = assetFolders.Total,
                Items = assetFolders.Select(x => AssetFolderDto.FromDomain(x, resources)).ToArray()
            };

            result.Path = path.Select(x => AssetFolderDto.FromDomain(x, resources)).ToArray();

            return(result.CreateLinks(resources));
        }
예제 #4
0
        private static AssetFoldersDto CreateLinks(AssetFoldersDto response, Resources resources)
        {
            var values = new { app = resources.App };

            response.AddSelfLink(resources.Url <AssetFoldersController>(x => nameof(x.GetAssetFolders), values));

            if (resources.CanUpdateAsset)
            {
                response.AddPostLink("create", resources.Url <AssetFoldersController>(x => nameof(x.PostAssetFolder), values));
            }

            return(response);
        }
예제 #5
0
        private static AssetFoldersDto CreateLinks(AssetFoldersDto response, ApiController controller, string app)
        {
            var values = new { app };

            response.AddSelfLink(controller.Url <AssetFoldersController>(x => nameof(x.GetAssetFolders), values));

            if (controller.HasPermission(Permissions.AppAssetsUpdate))
            {
                response.AddPostLink("create", controller.Url <AssetFoldersController>(x => nameof(x.PostAssetFolder), values));
            }

            return(response);
        }