- Timestamp:
- 01/03/23 19:29:20 (23 months ago)
- Branches:
- main
- Children:
- 60de3eb
- Parents:
- eaf0f1b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/autopartz/controller/UserController.java
reaf0f1b rfeffc2f 2 2 3 3 import com.example.autopartz.model.*; 4 import com.example.autopartz.model.views.*; 4 5 import com.example.autopartz.repository.*; 5 6 import com.example.autopartz.service.UserService; 7 import org.springframework.stereotype.Controller; 8 import org.springframework.ui.Model; 6 9 import org.springframework.web.bind.annotation.*; 7 10 8 11 import java.util.List; 9 12 10 @ RestController13 @Controller 11 14 @RequestMapping("/") 12 15 public class UserController { … … 39 42 } 40 43 @GetMapping("orders/{id}") 41 public List<OrdersForUser> getOrdersForUser(@PathVariable Long id){ 42 return ordersForUserRepository.findAllByUserid(id); 44 public String getOrdersForUser(@PathVariable Long id, Model model){ 45 model.addAttribute("userOrders",ordersForUserRepository.findAllByUserid(id)); 46 return "ordersForUser"; 43 47 } 44 48 @GetMapping("repairs/{id}") 45 public List<RepairsForUser> getRepairsForUser(@PathVariable Long id){ 46 return repairsForUserRepository.findAllByUserid(id); 49 public String getRepairsForUser(@PathVariable Long id,Model model){ 50 model.addAttribute("userRepairs",repairsForUserRepository.findAllByUserid(id)); 51 return "repairsForUser"; 47 52 } 48 53 @GetMapping("reviews/{id}") 49 public List<ReviewsForUser> getReviewsForUser(@PathVariable Long id){ 50 return reviewsForUserRepository.findAllByUserid(id); 54 public String getReviewsForUser(@PathVariable Long id, Model model){ 55 model.addAttribute("userReviews",reviewsForUserRepository.findAllByUserid(id)); 56 return "reviewsForUser"; 51 57 } 52 58 }
Note:
See TracChangeset
for help on using the changeset viewer.