コード例 #1
0
ファイル: Program.cs プロジェクト: NioArk/MovieNight
        public static void AddGenre()
        {
            Console.Write("Add Genre: ");
            string genre = Console.ReadLine();

            GenreManager.AddGenre(new Genre(genre));
            Console.Write(genre + " has been added to Genres");
            Console.WriteLine("\nPress any key to continue...");
            Console.ReadKey();
            Console.Clear();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: NioArk/MovieNight
        public static void DeleteGenre()
        {
            int          genId;
            bool         notANum;
            List <Genre> genres;

            do
            {
                Console.Write("Which actor would you like to delete?\n");
                genres = GenreManager.GenreList("");
                int i = 0;
                foreach (Genre genre in genres)
                {
                    i++;
                    Console.WriteLine(i + ") " + genre.Type);
                }

                notANum = false;
                Console.Write("Input: ");
                if (!int.TryParse(Console.ReadLine(), out genId))
                {
                    Console.WriteLine("Invalid input");
                    Console.ReadKey();
                    notANum = true;
                }
                Console.Clear();
            } while (notANum);
            int delGen = genres[genId - 1].ID;

            Console.Write("Are you sure you want to delete " + genres[genId - 1].Type + "? \n1) Yes \n2) No \nInput: ");
            if (!int.TryParse(Console.ReadLine(), out int sure))
            {
                Console.WriteLine("Invalid input");
                Console.ReadKey();
                notANum = true;
            }
            if (sure == 1)
            {
                GenreManager.DeleteGenre(genres[genId - 1]);
                Console.Write("Genre has been deleted");
                Console.ReadKey();
                Console.Clear();
            }
            else
            {
                Console.WriteLine("Deletion has been cancelled");
                Console.ReadKey();
                Console.Clear();
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: NioArk/MovieNight
        public static void UpdateGenre()
        {
            Console.Write("Which genre would you like to edit?\n");
            List <Genre> genres = GenreManager.GenreList("");
            int          i      = 0;

            foreach (Genre genre in genres)
            {
                i++;
                Console.WriteLine(i + ") " + genre.Type);
            }

            int  genId;
            bool notANum;

            do
            {
                notANum = false;
                Console.Write("Input: ");
                if (!int.TryParse(Console.ReadLine(), out genId))
                {
                    Console.WriteLine("Invalid input");
                    Console.ReadKey();
                    notANum = true;
                }
                Console.Clear();
            } while (notANum);

            Console.Clear();
            int updGen = genres[genId - 1].ID;

            Console.Clear();
            Console.Write("Type: ");
            string type = Console.ReadLine();

            Console.Clear();

            GenreManager.UpdateGenre(new Genre(updGen, type));

            Console.WriteLine("Genre has now been updated");
            Console.ReadKey();
            Console.Clear();
        }