source: src/main/java/com/example/villadihovo/web/controller/ControllersForAllReservations/ActivityReservationsController.java

Last change on this file was f7c05a1, checked in by Elena Shulevska <elena.shulevska@…>, 15 months ago

initial commit of the source code on origin

  • Property mode set to 100644
File size: 1.8 KB
Line 
1package com.example.villadihovo.web.controller.ControllersForAllReservations;
2
3import com.example.villadihovo.dto.ReservationForActivityDto;
4import com.example.villadihovo.model.statistics.StatisticsForActivity;
5import com.example.villadihovo.service.reservation.ReservationForActivityService;
6import com.example.villadihovo.service.statistics.StatisticsForActivityService;
7import lombok.AllArgsConstructor;
8import org.springframework.beans.factory.annotation.Autowired;
9import org.springframework.stereotype.Controller;
10import org.springframework.ui.Model;
11import org.springframework.web.bind.annotation.GetMapping;
12import org.springframework.web.bind.annotation.RequestMapping;
13import org.springframework.web.bind.annotation.RestController;
14import org.springframework.web.servlet.ModelAndView;
15
16import java.util.List;
17
18@Controller
19@RequestMapping("/reservations/activity")
20public class ActivityReservationsController {
21 @Autowired
22 private ReservationForActivityService reservationForActivityService;
23 @Autowired
24 private StatisticsForActivityService statistics;
25
26 @GetMapping
27 public String listAllActivityReservations(Model model){
28 List<ReservationForActivityDto> allActivityReservations = this.reservationForActivityService.findAllActivityReservations();
29 model.addAttribute("activityReservations", allActivityReservations);
30 return "activity-reservations";
31 }
32
33 @GetMapping("/statistics")
34 public String listAllActivitiesAndStatistics(Model model){
35 List<ReservationForActivityDto> allActivityReservations = this.reservationForActivityService.findAllActivityReservations();
36 List<StatisticsForActivity> statistics = this.statistics.listAll();
37 model.addAttribute("activityReservations", allActivityReservations);
38 model.addAttribute("statistics", statistics);
39 return "activity-statistics";
40 }
41
42
43
44}
Note: See TracBrowser for help on using the repository browser.