예제 #1
0
        public bool AddSongToPlayList(string url, string playListIdString, int profileId)
        {
            int playListId = 0;

            try
            {
                int songId = new SongController().GetSongByUrl(url).ActivityId;
                playListId = Int32.Parse(playListIdString);
                SqlConnection con = new DbConnection().GetConnection();
                try
                {
                    if (dbPlayList.IsSongInPlayList(songId, playListId, null, con))
                    {
                        return(false);
                    }

                    if (dbPlayList.IsPlaylistOwner(playListId, profileId, null, con) && dbPlayList.AddSongToPlayList(songId, playListId, null, con) > 0)
                    {
                        return(true);
                    }
                }
                finally
                {
                    con.Close();
                }
                return(false);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
예제 #2
0
 public bool RemoveSongFromPlaylist(string url, string playListIdString, int profileId)
 {
     try
     {
         int playlistId = Int32.Parse(playListIdString);
         int songId     = new SongController().GetSongByUrl(url).ActivityId;
         if (dbPlayList.IsPlaylistOwner(playlistId, profileId) && dbPlayList.RemoveSongFromPlaylist(songId, playlistId) > 0)
         {
             return(true);
         }
         return(false);
     }
     catch (Exception e)
     {
         Debug.WriteLine(e);
         return(false);
     }
 }