public void UpdateSong()
        {
            var savedSongId = musicPlaylist.Add(_registerSongRequest);

            var updatedSong = musicPlaylist.Update(savedSongId, _updateSongRequest);

            var possibleSong  = musicPlaylist.GetById(savedSongId);
            var retrievedSong = possibleSong.Value;

            Assert.AreEqual(retrievedSong.Artist, updatedSong.Artist);
        }
 public HttpResponseMessage UpdateSong(string id, [FromBody] UpdateSongRequest request)
 {
     logger.Info("Updating song");
     try
     {
         var updatedSong = playlist.Update(id, request);
         return(this.Request.CreateResponse(HttpStatusCode.OK, updatedSong));
     }
     catch (SongNotFoundException e)
     {
         logger.Warn("Could not find song to update");
         return(this.Request.CreateResponse(HttpStatusCode.NotFound));
     }
 }
        /// <summary>
        /// Updates a song.
        /// </summary>
        /// <param name="songId">The id of the song to update.</param>
        /// <param name="request">The updates to enact.</param>
        /// <returns>The updated song</returns>
        public Song UpdateSong(string songId, UpdateSongRequest request)
        {
            Song result;

            try
            {
                result = playlist.Update(songId, request);
            }
            catch (SongNotFoundException e)
            {
                result = new Song();
            }
            catch (Exception e)
            {
                logger.Error(e.ToString());
                System.Diagnostics.Trace.Write(e.ToString());
                result = new Song();
            }

            return(result);
        }