Ejemplo n.º 1
0
        public StorageSpaceFolder CreateFolder(string organizationId, int itemId, string type, long quotaInBytes, QuotaType qoutaType)
        {
            var storageId = StorageSpacesController.FindBestStorageSpaceService(new DefaultStorageSpaceSelector(), ResourceGroups.HostedOrganizations, quotaInBytes);

            if (!storageId.IsSuccess)
            {
                throw new Exception(storageId.ErrorCodes.First());
            }

            var folder = StorageSpacesController.CreateStorageSpaceFolder(storageId.Value, ResourceGroups.HostedOrganizations, organizationId, type, quotaInBytes, qoutaType);

            if (!folder.IsSuccess)
            {
                throw new Exception(string.Join("---------------------------------------", folder.ErrorCodes));
            }

            DataProvider.AddOrganizationStoragSpacesFolder(itemId, type, folder.Value);

            return(StorageSpacesController.GetStorageSpaceFolderById(folder.Value));
        }