// GET: Admin/Video
        public ActionResult VideoList()
        {
            List <VideoDTO> dtoList = new List <VideoDTO>();

            dtoList = bll.GetVideos();
            return(View(dtoList));
        }
示例#2
0
        private static void VideoList()
        {
            Console.Clear();

            List <Video> videos = bll.GetVideos();

            if (videos.Count == 0)
            {
                Console.WriteLine("You chose to see the list of videos! " +
                                  "\nYou haven't added any videos yet!");

                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;
                }
            }
            else
            {
                Console.WriteLine("\nWould you like to see one video, or a list or all videos?" +
                                  "\n1: Search for video" +
                                  "\n2: List of all videos");

                switch (int.Parse(Console.ReadLine().Trim()))
                {
                case 1:
                    Console.WriteLine("Input the title of the video:");

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

                    Char[] array = title.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();
                                VideoList();
                                break;

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

                            default:
                                Environment.Exit(0);
                                break;
                            }
                        }
                    }
                    Video vid = bll.GetVideo(title);
                    Console.WriteLine($"\nInformation about {title}:");
                    Console.WriteLine($"{vid.Title}, {vid.Date.ToShortDateString()}, {vid.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;
                    }

                    break;

                case 2:
                    Console.WriteLine("You chose to see the list of videos! \n" +
                                      "\nList of videos: " +
                                      "\n(Title, Date, Storyline) \n");

                    foreach (Video video in bll.GetVideos())
                    {
                        Console.WriteLine($"{video.Title}, {video.Date.ToShortDateString()}, {video.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;
                    }
                    break;
                }
            }
        }