static void Main(string[] args) { //CreateDatabase.CreateDB(); UserRepository user = new UserRepository(conString); DisplayUser dispUser = new DisplayUser(); SongRepository song = new SongRepository(conString); DisplaySong dispSong = new DisplaySong(); PlaylistRepository playlist = new PlaylistRepository(conString); DisplayPlaylist dispPlaylist = new DisplayPlaylist(); DisplayMainMenu menu = new DisplayMainMenu(); dispUser.UserLogin(); menu.DisplayMenu(); }
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(); } } }
public void DisplayMenu() { DisplayUser dispUser = new DisplayUser(); DisplaySong dispSong = new DisplaySong(); DisplayPlaylist dispPlaylist = new DisplayPlaylist(); int operationInt = 0; while (operationInt != 4) { Console.WriteLine("..................................."); Console.WriteLine("Press 1 for user options"); Console.WriteLine("Press 2 for song options"); Console.WriteLine("Press 3 for playist options"); Console.WriteLine("Press any other key to exit" + Environment.NewLine); operationInt = Convert.ToInt32(Console.ReadLine()); MenuOperation operation = (MenuOperation)operationInt; switch (operation) { case MenuOperation.User: dispUser.PrintUserMenu(); break; case MenuOperation.Song: dispSong.PrintSongMenu(); break; case MenuOperation.Playlist: dispPlaylist.PrintPlaylistMenu(); break; default: break; } } }