Exemple #1
0
        public void AddSongToPlaylist()
        {
            int exitNum = 0;

            while (exitNum == 1 || exitNum == 0)
            {
                if (exitNum == 0)
                {
                    Console.WriteLine(("Adding song to a playlist..."));
                    DisplaySong song = new DisplaySong();
                    song.GetAllSongs();
                    Console.WriteLine("..........................................");
                    GetAllPlaylists();
                    Console.WriteLine("..........................................");
                    Console.WriteLine("Song ID: ");
                    int songID = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("Playlist ID: ");
                    int playlistID = Convert.ToInt32(Console.ReadLine());

                    if (playlistRepo.UserOwnsPlaylist(playlistInfo.ID) || AuthenticationService.LoggedUser.ID == 1)
                    {
                        playlistRepo.AddSongToPlaylist(songID, playlistID);
                    }
                    else
                    {
                        Console.WriteLine("You can not add song to the playlist, as you are not the owner! ");
                    }

                    Console.WriteLine(Environment.NewLine + "Input 0 to continue adding songs");
                    Console.WriteLine("Input 1 to go to main menu");
                    Console.WriteLine("Input any other number to exit");

                    exitNum = Convert.ToInt32(Console.ReadLine());
                }
                else if (exitNum == 1)
                {
                    DisplayMainMenu menu = new DisplayMainMenu();
                    menu.DisplayMenu();
                }
            }
        }
Exemple #2
0
 public IActionResult AddSongToPlaylist(int songId, int playlistId)
 {
     playlistRepository.AddSongToPlaylist(songId, playlistId);
     return(NoContent());
 }