예제 #1
0
 /// <summary>
 /// Loads the albums.
 /// </summary>
 /// <remarks>
 /// Author(s): Miguel Gonzales and Andrea Tan
 /// </remarks>
 public void LoadAlbums()
 {
     var albumNodes = this.document.Descendants("album");
     foreach (var albumInfo in albumNodes)
     {
         var album = new XmlAlbum(this, albumInfo);
         this.albums.Add(album.AlbumId, album);
     }
 }
예제 #2
0
        /// <summary>
        /// Adds an album with the specified album name to the repository, then returns the new album to the caller.
        /// </summary>
        /// <param name="albumName">Name of the album.</param>
        /// <returns>The newly created album.</returns>
        /// <remarks>
        ///   <para>Author(s): Miguel Gonzales, Andrea Tan, Jim Counts and Eric Wei</para>
        ///   <para>Modified: 2011-10-28</para>
        /// </remarks>
        public IAlbum AddAlbum(string albumName)
        {
            this.ThrowOnInvalidAlbumName(albumName);

            // Update XML
            XElement albumElement = XmlAlbum.CreateAlbumElement(albumName);
            this.document.Descendants().First().Add(albumElement);
            var album = new XmlAlbum(this, albumElement);

            // Update Album Index
            this.albums.Add(album.AlbumId, album);
            return album;
        }