public BookTreeNode(Book book) { Book = book; ImageKey = "Book"; SelectedImageKey = "Book"; Text = book.RowKey; }
private void SaveBook() { if (String.IsNullOrEmpty(bookTitle.Text)) { MessageBox.Show("Please provide a book title before continuing."); bookTitle.Focus(); return; } if (String.IsNullOrEmpty(bookAuthor.Text)) { MessageBox.Show("Please provide a book author before continuing."); bookAuthor.Focus(); return; } if (String.IsNullOrEmpty(bookCategory.Text)) { MessageBox.Show("Please provide a book category before continuing."); bookCategory.Focus(); return; } // Save the book... CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); TableServiceContext tableContext = tableClient.GetDataServiceContext(); var book = new Book(bookTitle.Text, bookAuthor.Text, bookCategory.Text); tableClient.CreateTableIfNotExist("Book"); tableContext.AttachTo("Book", book); tableContext.UpdateObject(book); tableContext.SaveChangesWithRetries(SaveChangesOptions.ReplaceOnUpdate); CreateNewBook(); }