public void DeleteEmployeeExecute() { MessageBoxResult messageBoxResult = MessageBox.Show("Are you sure that you want to delete the employee?", "Delete Confirmation", MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { try { if (Employee != null) { serviceEmployee.DeleteEmployee(Employee.EmployeeID); EmployeeList = serviceEmployee.GetAllEmployees(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
public void EmployeeDelete() { EmployeeDto employeeDto = new EmployeeDto { TCompany = new CompanyDto { CompanyID = 2 }, UserName = "******", Password = "******" }; var employee = ServiceEmployee.FindByUserName(employeeDto); if (employee != null) { System.Diagnostics.Debug.WriteLine(String.Format("Id: {0} -> Name: {1} ", employee.EmployeeID, employee.FirstName + " " + employee.LastName)); ServiceEmployee.DeleteEmployee(employee); } }