private static void UpdateSerie()
        {
            Console.Write("Enter the series id: ");
            int serieIndex = int.Parse(Console.ReadLine());

            var typeGenre = typeof(EGenre);

            foreach (int genre_index in Enum.GetValues(typeGenre))
            {
                Console.WriteLine($"{genre_index}: {Enum.GetName(typeGenre, genre_index)}");
            }
            Console.Write("Enter the genre between the options above: ");
            int genre = int.Parse(Console.ReadLine());

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

            Console.Write("Enter the Year of Beginning of the Series: ");
            int year = int.Parse(Console.ReadLine());

            Console.Write("Enter the Series Description: ");
            string entradaDescricao = Console.ReadLine();

            Serie serie = new Serie(id: serieIndex,
                                    genre: (EGenre)genre,
                                    title: title,
                                    year: year,
                                    description: entradaDescricao);

            repository.Update(serie);
        }
Ejemplo n.º 2
0
        private static void AtualizarSerie()
        {
            Console.Write("Digite o id da série: ");
            int indiceSerie = int.Parse(Console.ReadLine());

            // https://docs.microsoft.com/pt-br/dotnet/api/system.enum.getvalues?view=netcore-3.1
            // https://docs.microsoft.com/pt-br/dotnet/api/system.enum.getname?view=netcore-3.1
            foreach (int i in Enum.GetValues(typeof(Gender)))
            {
                Console.WriteLine("{0}-{1}", i, Enum.GetName(typeof(Gender), i));
            }
            Console.Write("Digite o gênero entre as opções acima: ");
            int entradaGenero = int.Parse(Console.ReadLine());

            Console.Write("Digite o Título da Série: ");
            string entradaTitulo = Console.ReadLine();

            Console.Write("Digite o Ano de Início da Série: ");
            int entradaAno = int.Parse(Console.ReadLine());

            Console.Write("Digite a Descrição da Série: ");
            string entradaDescricao = Console.ReadLine();

            Serie atualizaSerie = new Serie(id: indiceSerie,
                                            gender: (Gender)entradaGenero,
                                            title: entradaTitulo,
                                            year: entradaAno,
                                            description: entradaDescricao);

            _repository.Update(indiceSerie, atualizaSerie);
        }
        public static void AtualizarSerie()
        {
            Console.WriteLine("Digite o Id da serie: ");
            int indiceSerie = int.Parse(Console.ReadLine());

            foreach (int i in Enum.GetValues(typeof(Genero)))
            {
                Console.WriteLine("{0} - {1} ", i, Enum.GetName(typeof(Genero), i));
            }

            Console.WriteLine("Digite o gênero entre as opções acima");
            int entradaGenero = int.Parse(Console.ReadLine());

            Console.WriteLine("Digite o titulo da Serie: ");
            string entradaTitulo = Console.ReadLine();

            Console.WriteLine("Digite o ano da serie: ");
            int entradaAno = int.Parse(Console.ReadLine());

            Console.WriteLine("Digite a sinopse da serie");
            string entradaDescricao = Console.ReadLine();

            Serie serieAtualizada = new Serie(id: indiceSerie,
                                              genero: (Genero)entradaGenero,
                                              titulo: entradaTitulo,
                                              ano: entradaAno,
                                              descricao: entradaDescricao
                                              );

            repositorio.Update(indiceSerie, serieAtualizada);
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            string userOption = "";

            while ((userOption = UserOption().ToUpper()) != "X")
            {
                switch (userOption)
                {
                case "1":
                    repository.ReadAll();
                    break;

                case "2":
                    repository.Create(UserOptionInsert());
                    break;

                case "3":
                    repository.Update(UserOptionFind(), UserOptionUpdate());
                    break;

                case "4":
                    repository.Delete(UserOptionFind());
                    break;

                case "5":
                    repository.ReadByID(UserOptionFind());
                    break;

                case "C":
                    Console.Clear();
                    break;

                default:
                    throw new ArgumentException("Invalid command!");
                }
            }
        }