/// <inheritdoc />
        protected override void ProcessRecord()
        {
            IMediaLibrary updatedLibrary = null;

            switch (this.ParameterSetName)
            {
            case OBJECTSET:
                updatedLibrary = this.BusinessLayer.Set(this.LibraryToSet.ActLike <IMediaLibrary>());
                break;

            case PROPERTYSET:
                updatedLibrary = this.BusinessLayer.Set(this.SiteID, this.LibraryName, this.DisplayName, this.Description, this.Folder);
                break;
            }

            if (this.PassThru.ToBool())
            {
                this.WriteObject(updatedLibrary.UndoActLike());
            }
        }
Esempio n. 2
0
        /// <inheritdoc/>
        public IMediaLibrary UpdateMediaLibrary(IMediaLibrary library, bool isReplace = true)
        {
            var updateLibrary = GetMediaLibrary(library);

            if (updateLibrary != null)
            {
                if (isReplace)
                {
                    updateLibrary = library.UndoActLike();
                }
                else
                {
                    // Updates the library properties
                    updateLibrary.LibraryDisplayName = library.LibraryDisplayName ?? updateLibrary.LibraryDisplayName;
                    updateLibrary.LibraryDescription = library.LibraryDescription ?? updateLibrary.LibraryDescription;
                    updateLibrary.LibraryFolder      = library.LibraryFolder ?? updateLibrary.LibraryFolder;
                }

                // Saves the updated library to the database
                MediaLibraryInfoProvider.SetMediaLibraryInfo(updateLibrary);
            }

            return(updateLibrary.ActLike <IMediaLibrary>());
        }
 /// <summary>
 /// When overridden in a child class, operates on the specified action.
 /// </summary>
 /// <param name="library">The media library to operate on.</param>
 protected virtual void ActOnObject(IMediaLibrary library)
 {
     this.WriteObject(library.UndoActLike());
 }