private static void addingBookFeature() { Book bk = new Book(); bk.BookID = MyConsole1.getNumber("Enter the ISBN no of this book"); bk.Title = MyConsole1.getString("Enter the title of this book"); bk.Author = MyConsole1.getString("Enter the Author of this book"); bk.Price = MyConsole1.getDouble("Enter the Price of this book"); try { bool result = mgr.AddNewBook(bk); if (!result) { Console.WriteLine("No more books could be added"); } else { Console.WriteLine($"Book by title {bk.Title} is added successfully to the database"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private static void updatingBookFeature() { Book bk = new Book(); bk.BookID = MyConsole1.getNumber("Enter the ISBN no of the book U wish to update"); bk.Title = MyConsole1.getString("Enter the new title of this book"); bk.Author = MyConsole1.getString("Enter the new Author of this book"); bk.Price = MyConsole1.getDouble("Enter the new Price of this book"); bool result = mgr.UpdateBook(bk); if (!result) { Console.WriteLine($"No book by this id {bk.BookID} found to update"); } else { Console.WriteLine($"Book by ID {bk.BookID} is updated successfully to the database"); } }