Exemple #1
0
        // GET: /Employee/GetById?Id="12345"
        public async Task <IActionResult> GetById([FromQuery] GetEmployeeByIdPayload employeeId)
        {
            try
            {
                var result = await _employeeService.GetByIdAsync(employeeId);

                return(Ok(result));
            }
            catch (Exception ex)
            {
                //_logger.LogError(ex.Message);
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
        public async Task <EmployeeDto> GetByIdAsync(GetEmployeeByIdPayload employeePayload)
        {
            var employees = await GetEmployeesFactory();

            return(employees.FirstOrDefault(t => t.Id == employeePayload.Id));
        }