Ignore:
Timestamp:
01/03/23 23:14:33 (23 months ago)
Author:
andrejtodorovski <82031894+andrejtodorovski@…>
Branches:
main
Children:
ae042f4
Parents:
60de3eb
Message:

Moved products page and added services page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/autopartz/controller/HomeController.java

    r60de3eb r6832924  
    33import com.example.autopartz.model.User;
    44import com.example.autopartz.repository.PartsForCarTypeAndCategoryRepository;
     5import com.example.autopartz.repository.RepairShopReviewSummaryRepository;
    56import com.example.autopartz.service.CarService;
    67import com.example.autopartz.service.CategoryService;
     
    2223    private final CarService carService;
    2324    private final CategoryService categoryService;
     25    private final RepairShopReviewSummaryRepository repairShopReviewSummaryRepository;
    2426
    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) {
    2628        this.loginService = loginService;
    2729        this.partService = partService;
     
    2931        this.carService = carService;
    3032        this.categoryService = categoryService;
     33        this.repairShopReviewSummaryRepository = repairShopReviewSummaryRepository;
    3134    }
    3235
    3336    @GetMapping()
    3437    public String getHomePage(Model model){
     38        model.addAttribute("bodyContent","home");
     39        return "master-template";
     40    }
     41    @GetMapping("/products")
     42    public String getProducts(Model model){
    3543        model.addAttribute("parts",partService.findAll());
    3644        model.addAttribute("cars",carService.findAll());
    3745        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");
    3953        return "master-template";
    4054    }
Note: See TracChangeset for help on using the changeset viewer.