mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 15:55:49 +00:00
poner seguridad en los show
This commit is contained in:
parent
e2f4234913
commit
e88a992681
4 changed files with 16 additions and 4 deletions
|
@ -104,13 +104,15 @@ public class FoodOfferController {
|
|||
public String processShowForm(@PathVariable("foodOfferId") int foodOfferId, Map<String, Object> model) {
|
||||
|
||||
FoodOffer foodOffer = this.foodOfferService.findFoodOfferById(foodOfferId);
|
||||
|
||||
if(!foodOffer.getStatus().equals(StatusOffer.active)) {
|
||||
return "error";
|
||||
}else {
|
||||
model.put("foodOffer", foodOffer);
|
||||
|
||||
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
|
||||
|
||||
return "offers/food/foodOffersShow";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping(value = "/offers/food/{foodOfferId}/edit")
|
||||
|
|
|
@ -133,10 +133,14 @@ public class NuOfferController {
|
|||
@GetMapping("/offers/nu/{nuOfferId}")
|
||||
public String processShowForm(@PathVariable("nuOfferId") int nuOfferId, Map<String, Object> model) {
|
||||
NuOffer nuOffer = this.nuOfferService.findNuOfferById(nuOfferId);
|
||||
if(!nuOffer.getStatus().equals(StatusOffer.active)) {
|
||||
return "error";
|
||||
}else {
|
||||
model.put("nuOffer", nuOffer);
|
||||
|
||||
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
|
||||
return "offers/nu/nuOffersShow";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -125,12 +125,15 @@ public class SpeedOfferController {
|
|||
|
||||
@GetMapping("/offers/speed/{speedOfferId}")
|
||||
public String processShowForm(@PathVariable("speedOfferId") int speedOfferId, Map<String, Object> model) {
|
||||
|
||||
SpeedOffer speedOffer = this.speedOfferService.findSpeedOfferById(speedOfferId);
|
||||
if(!speedOffer.getStatus().equals(StatusOffer.active)) {
|
||||
return "error";
|
||||
}else {
|
||||
model.put("speedOffer", speedOffer);
|
||||
|
||||
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
|
||||
return "offers/speed/speedOffersShow";
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping(value = "/offers/speed/{speedOfferId}/edit")
|
||||
|
|
|
@ -121,12 +121,15 @@ public class TimeOfferController {
|
|||
public String processShowForm(@PathVariable("timeOfferId") int timeOfferId, Map<String, Object> model) {
|
||||
|
||||
TimeOffer timeOffer = this.timeOfferService.findTimeOfferById(timeOfferId);
|
||||
|
||||
if(!timeOffer.getStatus().equals(StatusOffer.active)) {
|
||||
return "error";
|
||||
}else {
|
||||
model.put("timeOffer", timeOffer);
|
||||
|
||||
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
|
||||
|
||||
return "offers/time/timeOffersShow";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue