-
-
Save anirban99/1d6a02f6103f08d20de3fefc5fce35ca 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
@RestController | |
class EmployeeController(private val employeeService: EmployeeService) { | |
@GetMapping("/employees") | |
fun getAllEmployees(): List<Employee> = employeeService.getAllEmployees() | |
@GetMapping("/employees/{id}") | |
fun getEmployeesById(@PathVariable("id") employeeId: Long): Employee = | |
employeeService.getEmployeesById(employeeId) | |
@PostMapping("/employees") | |
fun createEmployee(@RequestBody payload: Employee): Employee = employeeService.createEmployee(payload) | |
@PutMapping("/employees/{id}") | |
fun updateEmployeeById(@PathVariable("id") employeeId: Long, @RequestBody payload: Employee): Employee = | |
employeeService.updateEmployeeById(employeeId, payload) | |
@DeleteMapping("/employees/{id}") | |
fun deleteEmployeesById(@PathVariable("id") employeeId: Long): Unit = | |
employeeService.deleteEmployeesById(employeeId) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment