Пример #1
0
 public BookListService(BookListStorage bookStorage)
 {
     if (ReferenceEquals(bookStorage, null))
     {
         throw new ArgumentException();
     }
     this.bookStorage = bookStorage;
 }
Пример #2
0
        static void Main(string[] args)
        {
            BookListStorage bookStorage = new BookListStorage(" ");
            BookListService bookService = new BookListService(bookStorage);

            bookService.AddBook(new Book("123456789", "Tolkien", "LOTR", "Russia", 1954, 2000, 100));
            bookService.AddBook(new Book("123456788", "Palanik", "Choke", "Russia", 2001, 336, 50));
            bookService.AddBook(new Book("123456788", "Palanik2", "Choke", "Russia", 2001, 336, 50));

            Print(bookService.FindBookByTag(new TitlePredicate("Choke")).ToList());

            Console.ReadKey();
        }
Пример #3
0
        private static void Main(string[] args)
        {
            IBookListStorage bookListStorage = new BookListStorage("Storage.bin");
            IBookListService bookListService = new BookListService(bookListStorage);

            bookListService.AddBook(new Book("978-0-7356-6745-7", "Jeffrey Richter", "CLR via C#", "Microsoft Press", 2017, 826, 59.99));
            bookListService.AddBook(new Book("978-1-4842-1332-2", "Andrew Troelsen", "C# 6.0 and the .NET 4.6 Framework", "APress", 2015, 1311, 44.99));

            var book = new List <Book>();

            book.Add(bookListService.FindBook(new FindBookByName("CLR via C#", bookListService.GetAllBooks().ToList())));
            book.Add(bookListService.FindBook(new FindBookByISBN("978-1-4842-1332-2", bookListService.GetAllBooks().ToList())));

            ShowBook(book);
            bookListService.Sort(null);
            ShowBook(bookListService.GetAllBooks());

            bookListService.Save();
            Console.ReadKey();
        }