private static void addingBookFeature() { Book bk = new Book(); bk.BookID = MyConsole.getNumber("Enter the ISBN no of this book"); bk.Title = MyConsole.getString("Enter the title of this book"); bk.Author = MyConsole.getString("Enter the Author of this book"); bk.Price = MyConsole.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); } }
static void Main(string[] args) { InitializeComponent(); bool @continue = true; do { string choice = MyConsole.getString(menu); @continue = processing(choice); } while (@continue); }
private static void readingFeature() { string title = MyConsole.getString("Enter the title or part of the title to search"); Book[] books = mgr.GetAllBooks(title); foreach (var bk in books) { if (bk != null) { Console.WriteLine(bk.Title); } } }
private static void updatingBookFeature() { Book bk = new Book(); bk.BookID = MyConsole.getNumber("Enter the ISBN no of the book U wish to update"); bk.Title = MyConsole.getString("Enter the new title of this book"); bk.Author = MyConsole.getString("Enter the new Author of this book"); bk.Price = MyConsole.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"); } }