Esempio n. 1
0
        private static Book GetBook(BooksRepository booksRepository)
        {
            var book = booksRepository.Get(2);

            Console.WriteLine($"{book.Title}: {book.PagesCount}");
            return(book);
        }
Esempio n. 2
0
        private static void AddBook(BooksRepository booksRepository)
        {
            var bookToAdd = new Book {
                Author = "Достоевский", Title = "Преступление и наказание", PagesCount = 400
            };

            booksRepository.Add(bookToAdd);
        }
Esempio n. 3
0
        private static void GetAllBooks(BooksRepository booksRepository)
        {
            var books = booksRepository.Get();

            foreach (var bookItem in books)
            {
                Console.WriteLine($"{bookItem.Title}: {bookItem.PagesCount}");
            }
        }
Esempio n. 4
0
        private static void UpdateBook(BooksRepository booksRepository, int bookId)
        {
            var bookToUpdate = new Book
            {
                Id         = bookId,
                Title      = "Дурная кровь",
                Author     = "Robert Gilbert",
                PagesCount = 900
            };

            booksRepository.Update(bookToUpdate);
        }
Esempio n. 5
0
 private static void DeleteBook(BooksRepository booksRepository, int id)
 {
     booksRepository.Delete(id);
 }