private void SaveEmployeeChanges() { int employeeId; if (int.TryParse(this.EmployeeNumber.Content.ToString(), out employeeId)) { var request = new UpdateEmployeeRequest(employeeId); var viewModel = this.CreateEmployeePropertiesViewModel(); request.EmployeePorperties = viewModel; this.employeeService.UpdateEmployee(request); } }
public UpdateEmployeeResponse UpdateEmployee(UpdateEmployeeRequest updateEmployeeRequest) { UpdateEmployeeResponse response = new UpdateEmployeeResponse(); try { var employee = this.employeeRepository.FindById(updateEmployeeRequest.Id); if (employee != null) { Gender gender; Gender.TryParse(updateEmployeeRequest.EmployeePorperties.Gender, out gender); employee.UpdateEmployeeData(updateEmployeeRequest.EmployeePorperties.FirstName, updateEmployeeRequest.EmployeePorperties.LastName, updateEmployeeRequest.EmployeePorperties.BirthDate, gender ); } } catch (Exception ex) { response.Exception = ex; } this.employeeRepository.Save(); return response; }