- Timestamp:
- 02/06/23 03:59:41 (22 months ago)
- Branches:
- master
- Children:
- f8ef9bd
- Parents:
- 448bd84
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/web/HomeController.java
r448bd84 reb5426c 3 3 4 4 import com.example.moviezone.model.Customer; 5 import com.example.moviezone.model.Film; 5 6 import com.example.moviezone.model.User; 6 7 import com.example.moviezone.model.exceptions.UserNotFoundException; … … 9 10 import org.springframework.stereotype.Controller; 10 11 import org.springframework.ui.Model; 11 import org.springframework.web.bind.annotation.GetMapping; 12 import org.springframework.web.bind.annotation.PostMapping; 13 import org.springframework.web.bind.annotation.RequestMapping; 14 import org.springframework.web.bind.annotation.RequestParam; 12 import org.springframework.web.bind.annotation.*; 15 13 16 14 import javax.servlet.http.HttpSession; 17 15 import java.time.LocalDate; 16 import java.util.List; 17 import java.util.Optional; 18 import java.util.stream.Collectors; 18 19 19 20 @Controller 20 @RequestMapping( "/")21 @RequestMapping({"/","/home"}) 21 22 public class HomeController { 22 23 … … 37 38 } 38 39 39 @GetMapping ({"/","/home"})40 @GetMapping 40 41 public String getHomePage(Model model) { 42 List<Film> films=filmService.findAllFilms(); 43 films=films.stream().limit(5).collect(Collectors.toList()); 44 model.addAttribute("films", films); 41 45 model.addAttribute("bodyContent", "home"); 46 47 return "master-template"; 48 } 49 @GetMapping("/getFilm/{id}") 50 public String getFilm(@PathVariable Long id, Model model) { 51 Optional<Film> film=filmService.getFilmById(id); 52 model.addAttribute("film", film); 53 model.addAttribute("bodyContent", "home"); 54 42 55 return "master-template"; 43 56 } … … 97 110 public String getProjectionsPage(Model model) 98 111 { 99 model.addAttribute("projections",projectionService.findAll AvailableProjections(LocalDate.now()));112 model.addAttribute("projections",projectionService.findAllProjections()); 100 113 model.addAttribute("bodyContent","projections"); 101 114 return "master-template";
Note:
See TracChangeset
for help on using the changeset viewer.