public static Serie newSerieHandler(SerieRepository pRepo, int pId = -1) { if (pId == -1) { pId = pRepo.NextId(); } Console.WriteLine(); Console.WriteLine("Digite o nome da série: "); string lTitle = Console.ReadLine(); Console.WriteLine(); var lGender = genderEnumHandler(); Console.WriteLine(); Console.WriteLine("Digite a descrição da série: "); var lDescription = Console.ReadLine(); Console.WriteLine(); Console.WriteLine("Digite o ano em que a série saiu: "); var lYear = Console.ReadLine(); var lReturnSerie = new Serie(pId, lGender, lTitle, lDescription, int.Parse(lYear)); return(lReturnSerie); }
private static void InlcudeSerie() { Console.WriteLine("Include new serie"); var typeGenre = typeof(EGenre); foreach (var genres in Enum.GetValues(typeGenre)) { Console.WriteLine($"{(int)genres}: {genres}"); } 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: repository.NextId(), genre: (EGenre)genre, title: title, year: year, description: entradaDescricao); repository.Push(serie); }
private static void InserirSerie() { Console.WriteLine("Inserir nova série"); // 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 novaSerie = new Serie(id: _repository.NextId(), gender: (Gender)entradaGenero, title: entradaTitulo, year: entradaAno, description: entradaDescricao); _repository.Create(novaSerie); }