- Timestamp:
- 01/03/23 23:14:33 (23 months ago)
- Branches:
- main
- Children:
- ae042f4
- Parents:
- 60de3eb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/autopartz/controller/HomeController.java
r60de3eb r6832924 3 3 import com.example.autopartz.model.User; 4 4 import com.example.autopartz.repository.PartsForCarTypeAndCategoryRepository; 5 import com.example.autopartz.repository.RepairShopReviewSummaryRepository; 5 6 import com.example.autopartz.service.CarService; 6 7 import com.example.autopartz.service.CategoryService; … … 22 23 private final CarService carService; 23 24 private final CategoryService categoryService; 25 private final RepairShopReviewSummaryRepository repairShopReviewSummaryRepository; 24 26 25 public HomeController(LoginService loginService, PartService partService, PartsForCarTypeAndCategoryRepository partsForCarTypeAndCategoryRepository, CarService carService, CategoryService categoryService ) {27 public HomeController(LoginService loginService, PartService partService, PartsForCarTypeAndCategoryRepository partsForCarTypeAndCategoryRepository, CarService carService, CategoryService categoryService, RepairShopReviewSummaryRepository repairShopReviewSummaryRepository) { 26 28 this.loginService = loginService; 27 29 this.partService = partService; … … 29 31 this.carService = carService; 30 32 this.categoryService = categoryService; 33 this.repairShopReviewSummaryRepository = repairShopReviewSummaryRepository; 31 34 } 32 35 33 36 @GetMapping() 34 37 public String getHomePage(Model model){ 38 model.addAttribute("bodyContent","home"); 39 return "master-template"; 40 } 41 @GetMapping("/products") 42 public String getProducts(Model model){ 35 43 model.addAttribute("parts",partService.findAll()); 36 44 model.addAttribute("cars",carService.findAll()); 37 45 model.addAttribute("categories",categoryService.findAll()); 38 model.addAttribute("bodyContent","homepage"); 46 model.addAttribute("bodyContent","products"); 47 return "master-template"; 48 } 49 @GetMapping("/services") 50 public String getServices(Model model){ 51 model.addAttribute("services",repairShopReviewSummaryRepository.findAll()); 52 model.addAttribute("bodyContent","services"); 39 53 return "master-template"; 40 54 }
Note:
See TracChangeset
for help on using the changeset viewer.