public static void user() { userMenu(); int input = InputCheck.CheckInteger("Please enter a number from the menu: ", 6); switch (input) { case 1: LibraryMethods.findByName(); break; case 2: LibraryMethods.findByAuthor(); break; case 3: LibraryMethods.findByGenre(); break; case 4: LibraryMethods.findByType(); break; case 5: Console.WriteLine(); LibraryMethods.findAllBooks(); break; default: Console.WriteLine("Thank you for using the Library!!!"); Console.WriteLine(); return; } user(); }
public static void admin() { Book b = new Book(); adminMenu(); int input = InputCheck.CheckInteger("Please enter a number from the menu: ", 9); switch (input) { case 1: LibraryMethods.findByName(); break; case 2: LibraryMethods.findByAuthor(); break; case 3: LibraryMethods.findByGenre(); break; case 4: LibraryMethods.findByType(); break; case 5: LibraryMethods.findAllBooks(); break; case 6: LibraryMethods.editBook(); break; case 7: LibraryMethods.addBook(); break; case 8: LibraryMethods.deleteBook(); break; default: Console.WriteLine("Thank you for using the Library!!!"); return; } admin(); }
public static void editBook() { var externalFile = new ExternalFile(); List <Book> books = ExternalFile.getData(); findAllBooks(); var bookNum = InputCheck.CheckInteger("Please enter a book number : ", books.Count); Console.WriteLine(Environment.NewLine + "Details of the book you choose"); Console.WriteLine(books[bookNum - 1].getName() + ":" + books[bookNum - 1].getAuthor() + ":" + books[bookNum - 1].getGenre() + ":" + books[bookNum - 1].getType()); Console.WriteLine(Environment.NewLine + "Enter new Book Author"); string editAuthor = Console.ReadLine(); books[bookNum - 1].setAuthor(editAuthor); externalFile.writeAllBooks(books); Console.WriteLine("Here is the updated Library\n"); Console.WriteLine("***************************\n"); findAllBooks(); }