Ejemplo n.º 1
0
 @RequestMapping(method = RequestMethod.DELETE)
 public ResponseEntity deleteUniversity(@RequestBody @Valid UniversityDTO university) {
   boolean deleted = universityService.deleteUniversity(university.getId());
   if (deleted == true) {
     return new ResponseEntity(HttpStatus.OK);
   }
   return new ResponseEntity(HttpStatus.NOT_FOUND);
 }
Ejemplo n.º 2
0
 @RequestMapping(method = RequestMethod.POST)
 public ResponseEntity createUniversity(@RequestBody @Valid UniversityDTO university) {
   UniversityDTO universityDTO = universityService.createUniversity(university);
   if (universityDTO != null) {
     return new ResponseEntity<>(universityDTO, HttpStatus.CREATED);
   }
   return new ResponseEntity<>(HttpStatus.CONFLICT);
 }
Ejemplo n.º 3
0
 @RequestMapping(method = RequestMethod.PUT)
 public ResponseEntity modifyUniversity(@RequestBody @Valid UniversityDTO university) {
   UniversityDTO universityDTO = universityService.modifyUniversity(university);
   if (universityDTO != null) {
     return new ResponseEntity<>(universityDTO, HttpStatus.OK);
   }
   return new ResponseEntity<>(HttpStatus.CONFLICT);
 }
Ejemplo n.º 4
0
 @RequestMapping(method = RequestMethod.GET)
 public ResponseEntity<List<UniversityDTO>> getUniversities() {
   List<UniversityDTO> universities = universityService.getUniversities();
   if (universities == null) {
     return new ResponseEntity<>(HttpStatus.NO_CONTENT);
   }
   return new ResponseEntity<>(universities, HttpStatus.OK);
 }