Exemplo n.º 1
0
 //Manual Addition of a book to the system
 public Book manualAddBook(Book book)
 {
     book.check = book.checkISBN(book);
     if (book.check == true)
     {
         string      bookToAdd = (book.isbn + "-" + book.title + "-" + book.author + "-" + book.description + "-" + book.stockNum);
         BookStorage addBook   = new BookStorage();
         addBook.writeBook(bookToAdd);
     }
     return(book);
 }
Exemplo n.º 2
0
        public Book addBookAPI(Book book, string data)
        {
            JObject       rawbook    = JObject.Parse(data);
            List <JToken> tokens     = rawbook["data"].Children().ToList();
            JToken        firstToken = tokens.First();
            APIBook       mybook     = firstToken.ToObject <APIBook>();

            book.title = mybook.title;
            if (mybook.author_name != null)
            {
                if (mybook.author_name.First() != null)
                {
                    book.author = mybook.author_name.First().name;
                }
            }
            book.description = mybook.summary;
            book.stockNum    = "1";
            string      bookToAdd = (book.isbn + "-" + book.title + "-" + book.author + "-" + book.description + "-" + book.stockNum);
            BookStorage addBook   = new BookStorage();

            addBook.writeBook(bookToAdd);
            book.check = true;
            return(book);
        }