private void UpdateClick(object sender, RoutedEventArgs e) { if (SelectedBook != null) { bool successfulUpdate = BooksService.updateBook(SelectedBook, UpdateBookAuthor, UpdateBookPageCount, UpdateBookTitle); Books = BooksService.getBookInventory(); IsDeleteEnabled = isUpdateEnabled = !successfulUpdate; } }
private void SearchClick(object sender, RoutedEventArgs e) { Books = BooksService.getBooksByTitle(FilterByTitle); }
/// <summary> /// These remaining methods handle events from the view, and rely on a different class for /// processing the data. Once that class returns results, these methods will update the /// dependency properties above, which will in turn update the data presented to the user. /// </summary> private void RemoveClick(object sender, RoutedEventArgs e) { BooksService.removeBook(SelectedBook); Books = BooksService.getBookInventory(); IsDeleteEnabled = isUpdateEnabled = false; }
private void AddClick(object sender, RoutedEventArgs e) { BooksService.addNewBook(NewBookAuthor, NewBookPageCount, NewBookTitle); Books = BooksService.getBookInventory(); IsDeleteEnabled = isUpdateEnabled = SelectedBook != null; }
public MainWindow() { DataContext = this; InitializeComponent(); Books = BooksService.getBookInventory(); }