@RequestMapping(method = RequestMethod.POST) public @ResponseBody boolean addStudent() { String id = UUID.randomUUID().toString(); String name = UUID.randomUUID().toString() + "Name"; StudentDTO stud = new StudentDTO(id, name); return studentService.insert(stud); }
@RequestMapping(value = "/students/{id}", method = RequestMethod.DELETE) public @ResponseBody boolean removeStudentById(@PathVariable String id) { studentService.removeStudentById(id); return true; }
@RequestMapping(value = "/{id}", method = RequestMethod.GET) public @ResponseBody StudentDTO addStudentById(@PathVariable String id) { return studentService.getStudentById(id); }
@RequestMapping(method = RequestMethod.GET) public @ResponseBody List<StudentDTO> getStudents() { return studentService.getStudents(); }