コード例 #1
0
 private void ChooseAuthor(int id_Book, string name_book, int year_of_writing_book)
 {
     while (true)
     {
         this.GetAuthors();
         Console.WriteLine("Что бы выбрать одного из уже добавленных авторов нажмите '1' что бы добавить нового автора нажмите '2'");
         var key = Console.ReadKey();
         if (key.Key == ConsoleKey.D1)
         {
             Console.Write("\nВведите id автора: ");
             int id_Author = Convert.ToInt32(Console.ReadLine());
             dB_Connection.AddLink(id_Author, id_Book);
             this.AnotherAuthor(name_book, year_of_writing_book, id_Book);
         }
         if (key.Key == ConsoleKey.D2)
         {
             Console.WriteLine();
             string surname_Authors = InsertAuthorSurname();
             dB_Connection.AddAuthor(surname_Authors);
             int id_Author = dB_Connection.GetIdAuthor(surname_Authors);
             dB_Connection.AddLink(id_Author, id_Book);
             this.AnotherAuthor(name_book, year_of_writing_book, id_Book);
         }
     }
 }