private static void AdicionarSerie()
        {
            System.Console.WriteLine("Inserir nova Série");
            foreach (int i in Enum.GetValues(typeof(Genero)))
            {
                System.Console.WriteLine($"{i} - {Enum.GetName(typeof(Genero), i)}");
            }
            System.Console.Write("Digite o Genero da serie: ");
            int genero = int.Parse(Console.ReadLine());

            System.Console.Write("Digite o Titulo da serie: ");
            string titulo = Console.ReadLine();

            System.Console.Write("Digite o Ano de Lancamento da serie: ");
            int ano = int.Parse(Console.ReadLine());

            System.Console.Write("Digite a Descricao da serie: ");
            string descricao = Console.ReadLine();

            Serie serie = new Serie(
                id: repository.NextId(),
                genero: (Genero)genero,
                titulo: titulo,
                ano: ano,
                descricao: descricao
                );

            repository.Insert(serie);
        }
Esempio n. 2
0
        private static void InserirSerie()
        {
            Console.WriteLine("Inserir séries: ");
            foreach (int i in Enum.GetValues(typeof(Genero)))
            {
                Console.WriteLine("{0}-{1}", i, Enum.GetName(typeof(Genero), i));
            }
            Console.Write("Escolha um gênero listado acima: ");
            int entradaGenero = int.Parse(Console.ReadLine());

            Console.WriteLine();
            Console.Write("Digite o titulo da série:");
            string entradaTitulo = Console.ReadLine();

            Console.WriteLine();
            Console.Write("Digite o nome do diretor:");
            string entradaDiretor = Console.ReadLine();

            Console.WriteLine();
            Console.Write("Digite a data de lançamento: ");
            int entradaLancamento = int.Parse(Console.ReadLine());

            Console.WriteLine();
            foreach (int i in Enum.GetValues(typeof(Plataforma)))
            {
                Console.WriteLine("{0}-{1}", i, Enum.GetName(typeof(Plataforma), i));
            }
            Console.WriteLine();
            Console.Write("Escolha uma plataforma listada acima: ");
            int entradaPlataforma = int.Parse(Console.ReadLine());

            Console.WriteLine();
            Console.Write("Descreva a série: ");
            string entradaDescricao = Console.ReadLine();

            Serie novaSerie = new Serie(id: repository.NextId(),
                                        genero: (Genero)entradaGenero,
                                        diretor: entradaDiretor, titulo: entradaTitulo,
                                        plataforma: (Plataforma)entradaPlataforma,
                                        dataLancamento: entradaLancamento,
                                        descricao: entradaDescricao);

            repository.Insert(novaSerie);
        }
Esempio n. 3
0
        private static void InsertSerie()
        {
            int genre, year;

            Console.WriteLine("Insert new series");

            do
            {
                foreach (int i in Enum.GetValues(typeof(Genre)))
                {
                    Console.WriteLine($"{i} - {Enum.GetName(typeof(Genre), i)}");
                }

                Console.Write("Enter the genre between the options above: ");

                if (int.TryParse(Console.ReadLine(), out genre) && Enum.IsDefined(typeof(Genre), genre))
                {
                    break;
                }

                Console.WriteLine("Invalid option, try again.");
            } while(true);

            Console.Write("Enter the series title: ");
            string title = Console.ReadLine();

            do
            {
                Console.Write("Enter the series release year: ");

                if (int.TryParse(Console.ReadLine(), out year))
                {
                    break;
                }

                Console.WriteLine("Invalid year, try again.");
            } while(true);

            Console.Write("Enter the series description: ");
            string description = Console.ReadLine();

            Serie newSerie = new Serie(id: repository.NextId(),
                                       genre: (Genre)genre,
                                       title: title,
                                       year: year,
                                       description: description);

            repository.Insert(newSerie);
        }