-
-
Save binerdy/170057998c5dda7d1984317b39464edb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpGet("{id}")] | |
public async Task<ActionResult<Employee>> GetEmployeeById(long id) | |
{ | |
try | |
{ | |
Employee employee = await _employeeRepository.Get(id); | |
return Ok(employee); | |
} | |
catch (EmployeeNotFoundException e) | |
{ | |
return NotFound(e.Message); | |
} | |
catch (ArgumentException e) | |
{ | |
return BadRequest(e.Message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment