Beispiel #1
0
        private static void CreateVideo()
        {
            Console.Clear();
            Console.WriteLine("You chose to create a video! " +
                              "\nPlease input the name of the video: ");

            string name = Console.ReadLine().Trim();

            Char[] array = name.ToCharArray();
            foreach (Char letter in array)
            {
                if (!Char.IsLetter(letter))
                {
                    Console.WriteLine("\nPlease input a name without special characters or numbers." +
                                      "\nWould you like to try again?" +
                                      "\nYes/No");

                    switch (Console.ReadLine().ToLower())
                    {
                    case "yes":
                        Console.Clear();
                        CreateVideo();
                        break;

                    case "no":
                        Menu(options);
                        break;

                    default:
                        Environment.Exit(0);
                        break;
                    }
                }
            }

            Console.WriteLine("\nInput date of release: (dd/MM/yyyy)");
            string   date = Console.ReadLine();
            DateTime dt   = Convert.ToDateTime(date);

            Console.WriteLine("\nInput storyline:");
            string storyLine = Console.ReadLine();

            try
            {
                bll.CreateVideo(name, dt, storyLine);

                Console.WriteLine("\n----------------------------------------" +
                                  "\nVideo Created!" +
                                  "\nYou input:");

                Console.WriteLine($"\nName: {name}" +
                                  $"\nDate of release: {date}" +
                                  $"\nStoryline: {storyLine}");

                Console.WriteLine("\nWould you like to go back to the menu or exit? \nMenu/Exit");

                switch (Console.ReadLine().ToLower())
                {
                case "menu":
                    Console.Clear();
                    Menu(options);
                    break;

                case "exit":
                    Environment.Exit(0);
                    break;

                default:
                    Environment.Exit(0);
                    break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("\n----------------------------------------" +
                                  "\nVideo Creation Failed!" +
                                  "\nWould you like to try again?" +
                                  "\nYes/No");

                switch (Console.ReadLine().ToLower())
                {
                case "yes":
                    Console.Clear();
                    CreateVideo();
                    break;

                case "no":
                    Menu(options);
                    break;

                default:
                    Environment.Exit(0);
                    break;
                }

                Console.WriteLine(ex.Message);
            }
        }