-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathEventController.java
More file actions
46 lines (38 loc) · 1.35 KB
/
EventController.java
File metadata and controls
46 lines (38 loc) · 1.35 KB
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
45
46
package org.launchcode.codingevents.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* Created by Chris Bay
*/
@Controller
@RequestMapping("events")
public class EventController {
private static HashMap<String, String> events = new HashMap<>();
@GetMapping
public String displayAllEvents(Model model) {
model.addAttribute("title", "All Events");
// model.addAttribute("events", events);
events.put("WWDC", "Apple Developer Conference");
events.put("LaunchCode", "LiftOff");
events.put("WWT", "Apprenticeship");
model.addAttribute("events", events);
return "events/index";
}
@GetMapping("create")
public String displayCreateEventForm(Model model) {
model.addAttribute("title", "Create Event");
return "events/create";
}
// @PostMapping("create")
// public String processCreateEventForm(@RequestParam String eventName) {
// events.put(eventName);
// return "redirect:";
// }
}