Example #1
0
        public Playlist CreateNewPlaylist()
        {
            var allSongs = _songService.GetAllItems();

            if (allSongs.Count == 0)
            {
                Console.WriteLine("You can't create your playlist, because database of songs is empty.");
                Console.WriteLine("Press any key to return to Main menu...");
                Console.ReadKey();
                return(null);
            }

            //create new playlist with id, name and without songs
            Console.Write("\r\nPlease name new playlist: ");
            string playlistName = Console.ReadLine();

            if (playlistName == "")
            {
                return(null);
            }

            int      lastId   = _playlistService.GetLastId();
            Playlist playlist = new Playlist(lastId + 1, playlistName);

            return(playlist);
        }
Example #2
0
        public bool RecommendationSwitcher(int choice)
        {
            List <Song> songs = _songService.GetAllItems();
            bool        again = true;

            switch (choice)
            {
            case 1:
                while (again)
                {
                    string      artistName = _menuView.ShowRecoBasedOnArtistMenu();
                    List <Song> recoSongs  = _recommendation.RecoBasedOnArtist(songs, artistName);
                    again = _menuView.ShowResultOfReco(recoSongs, "artist");
                }
                break;

            case 2:
                while (again)
                {
                    int         chosenGenre = _menuView.ShowRecoBasedOnGenreMenu();
                    List <Song> recoSongs   = _recommendation.RecoBasedOnGenre(songs, chosenGenre);
                    again = _menuView.ShowResultOfReco(recoSongs, "genre");
                }
                break;

            case 3:
                while (again)
                {
                    int[]       fromTill  = _menuView.ShowRecoBasedOnYearMenu();
                    List <Song> recoSongs = _recommendation.RecoBasedOnYear(songs, fromTill);
                    again = _menuView.ShowResultOfReco(recoSongs, "year of release");
                }
                break;

            case -1:     //return to Main Menu.
                again = false;
                break;

            default:
                Console.WriteLine("\r\nSuch option doesn't exist.");
                Continue();
                break;
            }
            return(again);
        }