Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. @PostMapping("/stands/add")
  2. public BikeStation createPosition(@RequestBody NewPositions newPositions){
  3. BikeStation bikeStation = bikeStationRepository.findOneById(newPositions.getStationId());
  4. for (int i = 0; i < newPositions.getNumberOfNewPositions(); i++){
  5. bikeStation.getStands().add(new Stand(Stand.isAvailable.YES));
  6. }
  7. bikeStationRepository.save(bikeStation);
  8. return bikeStation;
  9. }
  10.  
  11.  
  12. public interface BikeStationRepository extends CrudRepository<BikeStation, Integer> {
  13. BikeStation findOneById(int id);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement