24 lines
839 B
Java
24 lines
839 B
Java
package com.pmumali.ch5_trio.controller;
|
|
|
|
import com.pmumali.ch5_trio.dto.ResultatCourseDto;
|
|
import com.pmumali.ch5_trio.service.ResultatCourseService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
@RestController
|
|
@RequestMapping("/api/resultats")
|
|
public class ResultatCourseController {
|
|
@Autowired
|
|
private ResultatCourseService resultatCourseService;
|
|
|
|
@PostMapping
|
|
public ResponseEntity<?> enregistrerResultat(@RequestBody ResultatCourseDto resultatDto) {
|
|
try {
|
|
resultatCourseService.traiterResultatCourse(resultatDto);
|
|
return ResponseEntity.ok().build();
|
|
} catch (Exception e) {
|
|
return ResponseEntity.badRequest().body(e.getMessage());
|
|
}
|
|
}
|
|
} |