use of ua.springboot.web.entity.Car in project Logos_Materials_October_2017 by VolodymyrZavada.
the class CarController method showCarsByMake.
@GetMapping("/cars/filter")
public String showCarsByMake(@PageableDefault Pageable pageable, @RequestParam("search") String search, Model model) {
CarFilter filter = null;
if (search != null) {
filter = new CarFilter(search);
}
Page<Car> cars = carService.findAllCarsByMake(pageable, filter);
model.addAttribute("carsList", cars.getContent());
return "car/cars";
}
use of ua.springboot.web.entity.Car in project Logos_Materials_October_2017 by VolodymyrZavada.
the class CarController method generateRandomCars.
@GetMapping("sachascjksacnk/generate/random")
public String generateRandomCars() {
for (int i = 0; i < 800; i++) {
Car car = new Car();
car.setMake("CarMake #" + i);
car.setModel("CarModel #" + i);
car.setColor(colorService.findColorById(1));
carService.saveCar(car);
}
return "redirect:/car/cars";
}
use of ua.springboot.web.entity.Car in project Logos_Materials_October_2017 by VolodymyrZavada.
the class CarController method showAddCarForm.
@GetMapping("/create")
public String showAddCarForm(Model model) {
model.addAttribute("carModel", new Car());
model.addAttribute("colorsList", colorService.findAllColors());
return "car/create";
}
use of ua.springboot.web.entity.Car in project Logos_Materials_October_2017 by VolodymyrZavada.
the class CarController method showCreateCarPage.
@GetMapping("/create")
public String showCreateCarPage(Model model) {
model.addAttribute("carModel", new Car());
model.addAttribute("colorsList", colorService.findAllColors());
return "car/create";
}
use of ua.springboot.web.entity.Car in project Logos_Materials_October_2017 by VolodymyrZavada.
the class CarController method showCarsByTitleFilter.
@GetMapping("/cars/search")
public String showCarsByTitleFilter(@PageableDefault Pageable pageable, Model model, @RequestParam("search") String search) {
Page<Car> page = carService.findCarByMake(pageable, new CarMakeFilter(search));
model.addAttribute("carsList", page.getContent());
return "car/cars";
}
Aggregations