Last change
on this file was fdfbdde, checked in by Stojilkova Sara <sara.stojilkova.students.finki.ukim.mk>, 9 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | package com.example.task.controller;
|
---|
2 |
|
---|
3 | import com.example.task.service.ReminderService;
|
---|
4 | import lombok.AllArgsConstructor;
|
---|
5 | import org.springframework.stereotype.Controller;
|
---|
6 | import org.springframework.ui.Model;
|
---|
7 | import org.springframework.web.bind.annotation.GetMapping;
|
---|
8 | import org.springframework.web.bind.annotation.PathVariable;
|
---|
9 | import org.springframework.web.bind.annotation.PostMapping;
|
---|
10 | import org.springframework.web.bind.annotation.RequestParam;
|
---|
11 |
|
---|
12 | @Controller
|
---|
13 | @AllArgsConstructor
|
---|
14 | public class ReminderController {
|
---|
15 |
|
---|
16 | private final ReminderService reminderService;
|
---|
17 |
|
---|
18 | @GetMapping("/add/reminder/{id}")
|
---|
19 | public String getAddReminderPage(@PathVariable(name = "id") Integer id, Model model) {
|
---|
20 | model.addAttribute("id", id);
|
---|
21 | return "reminder";
|
---|
22 | }
|
---|
23 |
|
---|
24 | @PostMapping("/add/reminder")
|
---|
25 | public String addReminder(@RequestParam(name = "id") Integer id,
|
---|
26 | @RequestParam(name = "minutes") Integer minutes,
|
---|
27 | @RequestParam(name = "repeat") boolean repeat) throws Exception {
|
---|
28 | reminderService.addReminder(id, minutes, repeat);
|
---|
29 | return "redirect:/";
|
---|
30 | }
|
---|
31 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.