Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @PostMapping("/stands/add")
- public BikeStation createPosition(@RequestBody NewPositions newPositions){
- BikeStation bikeStation = bikeStationRepository.findOneById(newPositions.getStationId());
- for (int i = 0; i < newPositions.getNumberOfNewPositions(); i++){
- bikeStation.getStands().add(new Stand(Stand.isAvailable.YES));
- }
- bikeStationRepository.save(bikeStation);
- return bikeStation;
- }
- public interface BikeStationRepository extends CrudRepository<BikeStation, Integer> {
- BikeStation findOneById(int id);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement