Changeset 3ded84d in Git for src/main/java/com/wediscussmovies/project/web/controller/DiscussionsController.java
- Timestamp:
- 01/18/22 17:18:17 (3 years ago)
- Branches:
- main
- Children:
- e0ef1b1
- Parents:
- 7fafead
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/wediscussmovies/project/web/controller/DiscussionsController.java
r7fafead r3ded84d 2 2 3 3 import com.wediscussmovies.project.model.*; 4 import com.wediscussmovies.project.model.enumerations.DiscussionType; 4 5 5 import com.wediscussmovies.project.service.DiscussionService; 6 6 import com.wediscussmovies.project.service.MovieService; … … 14 14 import java.sql.Date; 15 15 import java.time.LocalDate; 16 import java.util.ArrayList;17 16 import java.util.List; 18 17 import java.util.Optional; … … 80 79 if(discussion.isEmpty()) 81 80 return "redirect:/discussions"; 82 Reply reply = new Reply(discussion.get(), user, date, text);83 replyService.save(reply);81 //Reply reply = new Reply(discussion.get(), user, date, text); 82 // replyService.save(reply); 84 83 return "redirect:/discussions/"+id; 85 84 } … … 103 102 return "redirect:/login"; 104 103 } 105 Long movie_id = (Long) request.getSession().getAttribute("movieId");104 Integer movie_id = (Integer) request.getSession().getAttribute("movieId"); 106 105 request.getSession().setAttribute("movieId", null); 107 106 Optional<Movie> movieOp = movieService.findById(movie_id); 108 107 if(movieOp.isEmpty()) 109 108 return "redirect:/movies"; 110 Discussion discussion = new Discussion(DiscussionType.M,text, title, Date.valueOf(LocalDate.now()),user,movieOp.get(),null,new ArrayList<>());111 discussionService.save(discussion);109 // Discussion discussion = new Discussion('M',text, title, Date.valueOf(LocalDate.now()),user,movieOp.get(),null); 110 // discussionService.save(discussion); 112 111 return "redirect:/discussions"; 113 112 } … … 137 136 if(personOp.isEmpty()) 138 137 return "redirect:/discussions"; 139 Discussion discussion = new Discussion(DiscussionType.P,title, text,Date.valueOf(LocalDate.now()),user,null,personOp.get(),new ArrayList<>()); 140 discussionService.save(discussion); 138 139 // Discussion discussion = new Discussion('P',title, text,Date.valueOf(LocalDate.now()),user,null,personOp.get()); 140 // discussionService.save(discussion); 141 141 return "redirect:/discussions"; 142 142 }
Note:
See TracChangeset
for help on using the changeset viewer.