private void UpdateMecanicButton_OnClick(object sender, RoutedEventArgs e) { IList selectedMechanics = MechanicsDataGrid.SelectedItems; int mechanicsSize = selectedMechanics.Count; for (var i = 0; i < mechanicsSize; i++) { DataRowView row = (DataRowView)MechanicsDataGrid.SelectedItems[i]; string textId = row["Id"].ToString(); int id = Convert.ToInt32(textId); Mecanic mecanic = _client.FindMecanicById(id); mecanic.Nume = row["Nume"].ToString(); mecanic.Prenume = row["Prenume"].ToString(); _client.UpdateMecanic(mecanic); } MechanicsTabItem_OnLoaded(sender, e); }