private void AddBookCommandAction(Object paramter) { var window = new AddBookWindow(); if (window.ShowDialog() == true) { var data = (AddBookWindowVM)window.DataContext; var filter = GetSelectedFilterType(); if (data.Book.Filter == filter || (filter == FilterType.ALL && filter != FilterType.NOT_OWNED)) { LoadBooks(); } } }
private void EditBookCommandAction(Object parameter) { Book book = parameter as Book; var window = new AddBookWindow(); var data = (AddBookWindowVM)window.DataContext; data.Book = new Book(book); if (window.ShowDialog() == true) { Books.Remove(book); var updatedBooks = BooksDAO.GetBookById(book.BookId); var filter = GetSelectedFilterType(); if (updatedBooks.Filter == filter || (filter == FilterType.ALL && filter != FilterType.NOT_OWNED)) { Books.Add(updatedBooks); RefreshBooks(); } } }