Ignore:
Timestamp:
02/06/23 20:10:28 (22 months ago)
Author:
DenicaKj <dkorvezir@…>
Branches:
master
Children:
d09caa7
Parents:
b5ce654
Message:

Adding Events To Home Page

Location:
src/main/java/com/example/moviezone
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/moviezone/model/Event.java

    rb5ce654 r0fb69cc  
    2424    String duration;
    2525    String repeating;
    26 
     26    String img_url;
    2727    LocalDate start_date;
    2828
    29     public Event(String theme, String duration, String repeating, LocalDate start_date) {
     29    public Event(String theme, String duration, String repeating, LocalDate start_date,String img_url) {
    3030        this.theme = theme;
    3131        this.duration = duration;
     32        this.img_url=img_url;
    3233        this.repeating = repeating;
    3334        this.start_date = start_date;
     
    3738
    3839    }
     40
    3941}
  • src/main/java/com/example/moviezone/service/EventService.java

    rb5ce654 r0fb69cc  
    88public interface EventService {
    99    List<Event> findAllEvents();
    10     Event save(LocalDate start_date,String theme,String duration,String repeating);
     10    Event save(LocalDate start_date,String theme,String duration,String repeating,String url);
    1111}
  • src/main/java/com/example/moviezone/service/Impl/EventServiceImpl.java

    rb5ce654 r0fb69cc  
    2323
    2424    @Override
    25     public Event save(LocalDate start_date, String theme, String duration, String repeating) {
    26         return eventRepository.save(new Event(theme,duration,repeating,start_date));
     25    public Event save(LocalDate start_date, String theme, String duration, String repeating,String img_url) {
     26        return eventRepository.save(new Event(theme,duration,repeating,start_date,img_url));
    2727    }
    2828}
  • src/main/java/com/example/moviezone/web/HomeController.java

    rb5ce654 r0fb69cc  
    22
    33
    4 import com.example.moviezone.model.Customer;
    5 import com.example.moviezone.model.Film;
    6 import com.example.moviezone.model.Role;
    7 import com.example.moviezone.model.User;
     4import com.example.moviezone.model.*;
    85import com.example.moviezone.model.exceptions.PasswordsDoNotMatchException;
    96import com.example.moviezone.model.exceptions.UserNotFoundException;
     
    4542        List<Film> films=filmService.findAllFilms();
    4643        films=films.stream().limit(5).collect(Collectors.toList());
     44        List <Event> events=eventService.findAllEvents().stream().limit(5).collect(Collectors.toList());
    4745        model.addAttribute("films", films);
     46        model.addAttribute("events",events);
    4847        model.addAttribute("bodyContent", "home");
    4948
     
    177176                                 @RequestParam String theme,
    178177                                 @RequestParam String duration,
     178                                @RequestParam String img_url,
    179179                            @RequestParam String repeating)
    180180    {
    181         eventService.save(start_date,theme,duration,repeating);
     181        eventService.save(start_date,theme,duration,repeating,img_url);
    182182        return "redirect:/home";
    183183    }
Note: See TracChangeset for help on using the changeset viewer.