public BookDetailsViewModel(Book selectedBook) { this.client = new ReadmillClient(AppContext.ClientId); this.SelectedBook = selectedBook; //find out if a reading exists for this book }
public Task<string> PostBookAsync(string accessToken, Book newBook) { IDictionary<string, string> parameters = GetInitializedParameterCollection(); parameters.Add(ReadmillConstants.AccessToken, accessToken); var booksUrl = booksUriTemplates[BooksUriTemplateType.Books].BindByName(this.readmillBaseUri, parameters); return PostAsync<Book>(newBook, booksUrl); }
/// <summary> /// Must only be called after the actual operation on Readmill has succeeded. /// This is only an optimization to avoid extra web service call /// </summary> /// <param name="book"></param> public void AddBookToLocalCollection(Book book) { lock (this) { //should never happen if (collectedBooks == null) throw new InvalidOperationException("Book collection must be already initialized."); if (!collectedBooks.ContainsKey(book.Id)) collectedBooks.Add(book.Id, book); } }
public BookHighlightsViewModel(Book selectedBook) : base(selectedBook) { client = new ReadmillClient(AppContext.ClientId); }