private void RemoveTool(object sender, RoutedEventArgs e) { if (ToolsListView.SelectedItem == null) { return; } var toolToRemove = (Tool)ToolsListView.SelectedItem; _db.RemoveTool(toolToRemove.ToolId); try { _db.SaveChanges(); } catch (Exception exc) { MessageBox.Show("Błąd usunięcia Firmy : " + exc.Message, "Uwaga", MessageBoxButton.OK, MessageBoxImage.Error); } DataContext = _db.GetAll(); RefreshList(); }