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)); }
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)); }
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)); }
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); }
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); }