コード例 #1
0
        private void CreateNewContent()
        {
            // New Content Object.
            StreamingContent content = new StreamingContent();

            // Ask user for Information.
            Console.WriteLine("Please Enter New Content Title: ");

            // Tile
            content.Title = Console.ReadLine();

            // Description
            Console.WriteLine($"Please Enter Description for {content.Title}: ");
            content.Description = Console.ReadLine();

            // Star Rating
            Console.WriteLine($"Please Enter Star Rating for {content.Title}: ");
            content.StarRating = float.Parse(Console.ReadLine());

            // Maturity Rating
            Console.WriteLine("Please Select a Maturity Rating: \n" + "1) G \n" + "2) PG \n" + "3) PG-13 \n" + "4) R \n" + "5) NC-17 \n" + "6) MA");
            string maturityResponse = Console.ReadLine();

            switch (maturityResponse)
            {
            case "1":
                content.MaturityRating = MaturityRate.G;
                break;

            case "2":
                content.MaturityRating = MaturityRate.PG;
                break;

            case "3":
                content.MaturityRating = MaturityRate.PG_13;
                break;

            case "4":
                content.MaturityRating = MaturityRate.R;
                break;

            case "5":
                content.MaturityRating = MaturityRate.NC_17;
                break;

            case "6":
                content.MaturityRating = MaturityRate.MA;
                break;
            }

            // TypeOfGenre: Horror = 1, RomCom, Fantasy, SciFi, Drama, Comedy, Action, Documentary, Suspence
            Console.WriteLine("Please Select a Genre: \n" + "1) Horror \n" + "2) Romantic Comedy \n" + "3) Science Fiction \n" + "4) Drama \n" + "5) Comedy \n" + "6) Action \n" + "7) Documentary \n" + "Suspence");
            string genreResponse = Console.ReadLine();
            int    genreID       = int.Parse(genreResponse);

            content.TypeOfGenre = (GenreType)genreID;

            // Need a New Content with Properties Filled out by user.
            // Then Pass that to the Add Method in our Repository.
            _streamingRepository.AddContenttoDirectory(content);
        }