Added delete event functionality

This commit is contained in:
2021-11-28 18:22:36 +01:00
parent e8c7fb8a08
commit 1a8bbbfce7
3 changed files with 15 additions and 9 deletions

View File

@@ -17,14 +17,15 @@ public class DataController {
private static final String ALL_EVENTS_ENDPOINT = "http://localhost:8080/vpr/all-events";
private static final String ALL_USERS_ENDPOINT = "http://localhost:8080/vpr/all-users";
private static final String ADD_EVENT_ENDPOINT = "http://localhost:8080/vpr/add-event";
private static final String DELETE_EVENT_ENDPOINT = "http://localhost:8080/vpr/del-event";
private HttpRequest httpRequest;
private final HttpRequest httpRequest;
public DataController(){
httpRequest = new HttpRequest();
}
public void CreateEvent(Event event){
public void createEvent(Event event){
try {
System.out.println(httpRequest.sendPostRequest(ADD_EVENT_ENDPOINT, event.getAsUrlParam()));
} catch (Exception e) {
@@ -32,6 +33,14 @@ public class DataController {
}
}
public void deleteEvent(int eventId){
try {
System.out.println(httpRequest.sendPostRequest(DELETE_EVENT_ENDPOINT, "eventId=" + eventId));
} catch (Exception e) {
e.printStackTrace();
}
}
public ArrayList<Event> getAllVisibleEvents() {
ArrayList<Event> eventList = new ArrayList<>();