Beispiel #1
0
        private Book ParseBook(XmlNode source)
        {
            var isbn   = ReadNodeText(source, "isbn");
            var author = ReadNodeText(source, "author");
            var title  = ReadNodeText(source, "title");

            return(bookFactory.Create(isbn, author, title));
        }
Beispiel #2
0
        public void Build()
        {
            var books = specificBookDataProviders
                        .SelectMany(p => SafeSelect(p).Select(b => new { Book = b, ProviderName = p.Name }))
                        .GroupBy(p => p.Book)
                        .Select(g => bookFactory.Create(g.Key, g.Select(p => p.ProviderName).ToArray()))
                        .ToArray();

            bookIndex.Rebuild(books);
        }
        public async Task <ActionResult <Book> > PostBook(BookVM bookVm)
        {
            var book = _bookFactory.Create(bookVm.Isbn, bookVm.Title, bookVm.Description);

            await _repository.Create(book);

            var res = Convert(book);

            return(CreatedAtAction(nameof(GetBook), new { isbnString = res.Isbn }, res));
        }
Beispiel #4
0
 public void AddBook(string isbn, string bookTitle, string copies, string publisher, DateTime dateTime, IList <IAuthor> authors, IList <string> categories)
 {
     try
     {
         book = bookfactory.Create(isbn, bookTitle, Convert.ToInt32(copies), publisher, dateTime, authors, categories);
     }
     catch
     {
         MessageBox.Show("Complete the fields");
     }
 }