Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. @RequestMapping("/station")
  2. @PostMapping
  3. public BikeStation createStation(@RequestBody NewBikeStation newBikeStation){
  4. BikeStation bikeStation = new BikeStation();
  5. bikeStation.setName(newBikeStation.getName());
  6. for (int i = 0; i < newBikeStation.getPositions(); i++){
  7. bikeStation.getPositions().add(new Position(Position.isAvailable.YES));
  8. }
  9. bikeStationRepository.save(bikeStation);
  10. return bikeStation;
  11. }
  12.  
  13.  
  14. @Getter
  15. @Setter
  16. public class NewBikeStation {
  17.  
  18. private String name;
  19.  
  20. private int positions;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement