public async Task <IActionResult> CreateEmployeeContactInfo([FromBody] CreateEmployeeContactInfo writeModel) { try { await _employeeCmdHdlr.Handle(writeModel); GetEmployeeContact queryParams = new GetEmployeeContact { PersonID = writeModel.PersonId }; IActionResult retValue = await _employeeQryReqHdler.Handle <GetEmployeeContact>(queryParams, HttpContext, Response); return(CreatedAtAction(nameof(GetEmployeeContact), new { personId = writeModel.PersonId }, (retValue as OkObjectResult).Value)); } catch (Exception ex) { _logger.LogError($"An exception has been thrown: {ex}"); return(BadRequest(ex.Message)); } }
public async Task <IActionResult> GetEmployeeContact(int personId, [FromQuery] PagingParameters pagingParams) { GetEmployeeContact queryParams = new GetEmployeeContact { PersonID = personId, }; try { var retValue = await _employeeQryReqHdler.Handle <GetEmployeeContact>(queryParams, HttpContext, Response); return(retValue); } catch (Exception ex) { _logger.LogError($"An exception has been thrown: {ex}"); return(BadRequest(ex.Message)); } }