private void button3_Click(object sender, EventArgs e) { MessageBox.Show(orderMechanicsListBox.SelectedItem.ToString()); Type entityType = ObjectContext.GetObjectType(orderMechanicsListBox.SelectedItem.GetType()); var selectedMechanic = MechanicMapper.FromModelToEntity((MechanicModel)orderMechanicsListBox.SelectedItem); clonedSessionData.mechanicRepository.DeleteMechanic(selectedMechanic.MecanicId); orderMechanicsListBox.Update(); }
private void addMechanicButton_Click(object sender, EventArgs e) { var availableMechanics = clonedSessionData.mechanicRepository.GetAvailableMechanicsToExecuteOperation(); if (availableMechanics.ToList().Count() > 0) { foreach (var mechanic in availableMechanics) { addedMechanics.Add(MechanicMapper.FromEntityToModel(mechanic)); orderMechanicsListBox.Items.Add(MechanicMapper.FromEntityToModel(mechanic)); } } else if (availableMechanics.ToList().Count() < 1) { MessageBox.Show("No available mechanics"); } }