

















Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!


















@GetMapping(name="/getAllStudent", produces = MediaType. APPLICATION_JSON_UTF8_VALUE) private List
@PutMapping(name="/updateStudent", produces = MediaType. APPLICATION_JSON_UTF8_VALUE) private StudentMessageResponse getAllStudent(@RequestBody Student student){ StudentMessageResponse studentMessageResponse = new StudentMessageResponse(); try{ studentService.updateStudent(student); studentMessageResponse.setIdCode(1); studentMessageResponse.setMessage("The student was updated successfully"); } catch(Exception ex){ studentMessageResponse.setIdCode(-1); studentMessageResponse.setMessage("There was an error"); studentMessageResponse.setError(ex.getMessage()); } return studentMessageResponse }
@DeleteMapping(name="/deleteStudent/{idStudent}", produces = MediaType. APPLICATION_JSON_UTF8_VALUE) private StudentMessageResponse deleteStudent(@PathVariable Long idStudent){ StudentMessageResponse studentMessageResponse = new StudentMessageResponse(); try{ studentService.deleteStudentById(idStudent); studentMessageResponse.setIdCode(1); studentMessageResponse.setMessage("The student was removed successfully"); } catch(Exception ex){ studentMessageResponse.setIdCode(-1); studentMessageResponse.setMessage("There was an error"); studentMessageResponse.setError(ex.getMessage()); } return studentMessageResponse; }
Desarrollo incremental de la capa de servicios y su exposición como servicios REST