So when I visit an enpoint(POST request), I first check if an entry already exists in my database. If yes, I want to return it to the user (for tracking purposes) and continue an operation. But I would like to return the id to the user and continue this process. How to achieve this??
@RestController
public class StudentController {
@Autowired
private StudentService service;
@PostMapping("/storeInDB")
@ResponseBody
public File_Tracking saveStudentDetails(@RequestBody Student student ) throws IOException {
List<Students> student = new ArrayList<>();
int continue = 0;
int id = 0;
id = service.getId(); // I want to return this and continue some other process which follows