Fin intégration jumele gagnant
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package com.pmumali.ch2_jumelegagnant.controller;
|
||||
|
||||
import com.pmumali.ch2_jumelegagnant.model.PariJumeleGagnant;
|
||||
import com.pmumali.ch2_jumelegagnant.service.PariJumeleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/paris-jumele")
|
||||
public class PariJumeleController {
|
||||
|
||||
@Autowired
|
||||
private PariJumeleService pariService;
|
||||
|
||||
@PostMapping
|
||||
public ResponseEntity<PariJumeleGagnant> placerPari(@RequestBody PariJumeleGagnant pari) {
|
||||
return ResponseEntity.ok(pariService.placerPari(pari));
|
||||
}
|
||||
|
||||
@GetMapping("/course/{courseId}")
|
||||
public ResponseEntity<List<PariJumeleGagnant>> obtenirParisParCourse(@PathVariable Long courseId) {
|
||||
return ResponseEntity.ok(pariService.obtenirParisParCourse(courseId));
|
||||
}
|
||||
|
||||
@GetMapping("/cheval/{chevalId}")
|
||||
public ResponseEntity<List<PariJumeleGagnant>> obtenirParisParCheval(@PathVariable Long chevalId) {
|
||||
return ResponseEntity.ok(pariService.obtenirParisParCheval(chevalId));
|
||||
}
|
||||
|
||||
@GetMapping("/calculer-formule-combinee/{nombreChevaux}")
|
||||
public ResponseEntity<Double> calculerCoutFormuleCombinee(@PathVariable int nombreChevaux) {
|
||||
return ResponseEntity.ok(pariService.calculerCoutFormuleCombinee(nombreChevaux));
|
||||
}
|
||||
|
||||
@GetMapping("/calculer-formule-champ")
|
||||
public ResponseEntity<Double> calculerCoutFormuleChamp(
|
||||
@RequestParam int nombreChevauxPartants,
|
||||
@RequestParam int nombreChevauxSelectionnes,
|
||||
@RequestParam boolean estChampTotal) {
|
||||
return ResponseEntity.ok(pariService.calculerCoutFormuleChamp(
|
||||
nombreChevauxPartants, nombreChevauxSelectionnes, estChampTotal));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user