private static Book GetBook(BooksRepository booksRepository) { var book = booksRepository.Get(2); Console.WriteLine($"{book.Title}: {book.PagesCount}"); return(book); }
private static void AddBook(BooksRepository booksRepository) { var bookToAdd = new Book { Author = "Достоевский", Title = "Преступление и наказание", PagesCount = 400 }; booksRepository.Add(bookToAdd); }
private static void GetAllBooks(BooksRepository booksRepository) { var books = booksRepository.Get(); foreach (var bookItem in books) { Console.WriteLine($"{bookItem.Title}: {bookItem.PagesCount}"); } }
private static void UpdateBook(BooksRepository booksRepository, int bookId) { var bookToUpdate = new Book { Id = bookId, Title = "Дурная кровь", Author = "Robert Gilbert", PagesCount = 900 }; booksRepository.Update(bookToUpdate); }
private static void DeleteBook(BooksRepository booksRepository, int id) { booksRepository.Delete(id); }