public static void deleteBook() { var externalFile = new ExternalFile(); List <Book> books = ExternalFile.getData(); findAllBooks(); Console.WriteLine("Please enter a book number"); var bookNum = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Details of the book you choose"); Console.WriteLine(books[bookNum - 1].getName() + ":" + books[bookNum - 1].getAuthor() + ":" + books[bookNum - 1].getGenre() + ":" + books[bookNum - 1].getType() + Environment.NewLine); books.RemoveAt(bookNum - 1); externalFile.writeAllBooks(books); Console.WriteLine("********************************************************"); }
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(); }