コード例 #1
0
ファイル: Program.cs プロジェクト: derentsev/BlackSound
        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();
        }
コード例 #2
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();
                }
            }
        }