GoogleCloudSamples.Services.BookDetailLookup.ProcessBook C# (CSharp) Method

ProcessBook() public method

Look up a book in Google's Books API. Update the book in the book store.
public ProcessBook ( IBookStore bookStore, long bookId ) : void
bookStore IBookStore Where the book is stored.
bookId long The id of the book to look up.
return void
        public void ProcessBook(IBookStore bookStore, long bookId)
        {
            var book = bookStore.Read(bookId);
            _logger.LogVerbose($"Found {book.Title}.  Updating.");
            var query = "https://www.googleapis.com/books/v1/volumes?q="
                + Uri.EscapeDataString(book.Title);
            var response = WebRequest.Create(query).GetResponse();
            var reader = new StreamReader(response.GetResponseStream());
            var json = reader.ReadToEnd();
            UpdateBookFromJson(json, book);
            bookStore.Update(book);
        }
        // [END processbook]