Merge branch 'Johan'
This commit is contained in:
@@ -15,6 +15,7 @@ import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -78,7 +79,7 @@ public class ArticleController {
|
||||
@RequestParam("code_postal") String code_postal,
|
||||
@RequestParam("ville") String ville,
|
||||
@RequestParam("dateDebut") String dateDebut,
|
||||
@RequestParam("dateFin") String datefin) {
|
||||
@RequestParam("dateFin") String dateFin) {
|
||||
//Récupérer l'utilisateur pour set l'article
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
String username = authentication.getName();
|
||||
@@ -90,14 +91,19 @@ public class ArticleController {
|
||||
retrait.setCode_postale(code_postal);
|
||||
retrait.setVille(ville);
|
||||
//Reste de l'article
|
||||
//Date dDateDebut = new SimpleDateFormat(dateDebut);
|
||||
//article.setDateDebutEnch();
|
||||
if (article.getId() == 0){
|
||||
//Création d'un article
|
||||
|
||||
} else {
|
||||
//Mise à jour d'un article
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date dDateDebut = null;
|
||||
Date dDateFin = null;
|
||||
try {
|
||||
dDateDebut = format.parse(dateDebut);
|
||||
dDateFin = format.parse(dateFin);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
article.setDateDebutEnch(dDateDebut);
|
||||
article.setDateFinEnch(dDateFin);
|
||||
retrait.setNumArticle(articleService.saveArticle(article));
|
||||
retraitService.setRetrait(retrait);
|
||||
return "redirect:/accueil";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user