Beispiel #1
0
        public async Task EditPackageNameRequest(EditPackageNameRequest editPackageNameRequest)
        {
            // Setup our state so we have everything we need.
            var folder = await connection.Folder.GetAsync(editPackageNameRequest.FolderIdentifier);

            // Here we're going to create a package map if one doesn't exist.
            var packageMap = folder.Read <EDiscoveryPackageMap>(MetadataKeyConstants.E_DISCOVERY_PACKAGE_MAP_METAKEY);

            // If this is the first package, we're going to create a package map.
            if (packageMap == null)
            {
                packageMap = new EDiscoveryPackageMap
                {
                    Map = new Dictionary <string, PackageAttributes>()
                };
            }

            // If this is the first package, we're going to create a package map.
            packageMap.Map[editPackageNameRequest.PackageName] = new PackageAttributes()
            {
                CustomName = editPackageNameRequest.CustomName
            };

            folder.Write <EDiscoveryPackageMap>(MetadataKeyConstants.E_DISCOVERY_PACKAGE_MAP_METAKEY, packageMap);
            await connection.Folder.PutAsync(folder);
        }
Beispiel #2
0
        private async Task UpsertPackageMap(FolderModel folder, string packageName, string customName)
        {
            // Here we're going to create a package map if one doesn't exist.
            var packageMap = folder.Read <EDiscoveryPackageMap>(MetadataKeyConstants.E_DISCOVERY_PACKAGE_MAP_METAKEY);

            // If this is the first package, we're going to create a package map.
            if (packageMap == null)
            {
                packageMap = new EDiscoveryPackageMap
                {
                    Map = new Dictionary <string, PackageAttributes>()
                };
            }
            packageMap.Map.Add(packageName, new PackageAttributes()
            {
                CustomName = customName
            });

            folder.Write <EDiscoveryPackageMap>(MetadataKeyConstants.E_DISCOVERY_PACKAGE_MAP_METAKEY, packageMap);
            await connection.Folder.PutAsync(folder);
        }