Esempio n. 1
0
 /// <summary>
 /// Adds a book to the db
 /// </summary>
 /// <param name="db">Class with needed methods</param>
 private static void AddABook(IDataRepository db, string connectionString)
 {
     try
     {
         string authorname, bookname;
         Console.WriteLine("Enter an book's name to add");
         bookname = Console.ReadLine();
         Console.WriteLine("Who has written that masterpiece?");
         authorname = Console.ReadLine();
         db.AddAnAuthorAndBook(authorname, bookname, connectionString);
         Console.WriteLine($"The book {bookname} by {authorname} was added to your collection");
     }
     catch (Exception ex)
     {
         RedConsole(ex);
     }
 }