Ejemplo n.º 1
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);
        }
 public MyBook(APIBook theBook)
 {
     this.theBook = theBook;
 }