-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathCommentsController.java
More file actions
44 lines (33 loc) · 983 Bytes
/
CommentsController.java
File metadata and controls
44 lines (33 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package controller;
import java.io.Serializable;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import model.Comment;
import model.database.MySQL;
@ManagedBean
@SessionScoped
public class CommentsController implements Serializable {
/**
* Creates a new instance of CommentsController
*/
public CommentsController() {
}
public void createComment(int post_id, String name, String email, String comment) {
MySQL mysql = new MySQL();
mysql.createComment(post_id, name, email, comment);
}
public List<Comment> getAllComments(int post_id) {
MySQL mysql = new MySQL();
return mysql.getAllComments(post_id);
}
public boolean deleteComment(int id) {
MySQL mysql = new MySQL();
return mysql.deleteComment(id);
}
}