private void FügeBuchHinzu(object parameter) { if (parameter is Book book) { var result = FavoriteBooksManager.AddFavoriteBook(book); if (result.success) { MessageBox.Show($"Buch {book.volumeInfo.title} wurde hinzugefügt!"); } else { MessageBox.Show(result.errorString); } } }
public FavoritePageVM() { FavoriteBooks = new ObservableCollection <Book>(FavoriteBooksManager.FavoriteBooks); AddFavoriteCommand = new DelegateCommand(param => FavoriteBooksManager.AddFavoriteBook(param as Book)); RemoveFavoriteCommand = new DelegateCommand(param => FavoriteBooksManager.RemoveFavoriteBook(param as Book)); }