public async Task UpdateEmployeesAsync(UpdateEmplyoeeModel employeeToUpdate) { var response = await _client.PutAsJsonAsync("api/EmployeeBenefits/UpdateEmployee", employeeToUpdate); if (!response.IsSuccessStatusCode) { //todo: log errors } }
public async Task UpdateEmployee(IUpdateCommandNoResult <EmployeeEntity> updateEmployeeCommand, IQuery <EmployeeEntity, Guid> getEmployeeAndSalaryQuery, UpdateEmplyoeeModel employeeModel) { var employeeToUpdate = await getEmployeeAndSalaryQuery.ExecuteQueryAsync(employeeModel.Id); employeeToUpdate.FirstName = employeeModel.FirstName; employeeToUpdate.LastName = employeeModel.LastName; employeeToUpdate.UpdatedOn = DateTime.Now; // todo: apply error checking before executing command await updateEmployeeCommand.ExecuteAsync(employeeToUpdate); }
public async Task <IActionResult> UpdateEmployee(UpdateEmplyoeeModel employee) { try { await new EmployeeOrchestration().UpdateEmployeeAsync(_employeeRepository, employee).ConfigureAwait(false); } catch (Exception ex) { return(BadRequest(ex.InnerException)); } return(Ok()); }
public async Task <IActionResult> UpdateEmployee(UpdateEmplyoeeModel employee) { try { await new EmployeeTransactions().UpdateEmployee(_updateEmployeeCommand, _getEmployeeAndCurrentSalaryQuery, employee).ConfigureAwait(false); } catch (Exception ex) { return(BadRequest(ex.InnerException)); } return(Ok()); }
public async Task UpdateEmployeesAsync(UpdateEmplyoeeModel employeeToUpdate) { try { var response = await _client.PutAsJsonAsync("api/Employee/UpdateEmployee", employeeToUpdate); if (response.IsSuccessStatusCode) { } else { } } catch (Exception ex) { // add log throw; } }
public async Task UpdateEmployeeAsync(IEmployeeRepository employeeRepository, UpdateEmplyoeeModel employeeToUpdate) { //todo: add logs and error checking await employeeRepository.UpdateEmployeesAsync(employeeToUpdate); }