source: src/main/java/com/example/task/controller/ReminderController.java@ fdfbdde

Last change on this file since fdfbdde 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 
1package com.example.task.controller;
2
3import com.example.task.service.ReminderService;
4import lombok.AllArgsConstructor;
5import org.springframework.stereotype.Controller;
6import org.springframework.ui.Model;
7import org.springframework.web.bind.annotation.GetMapping;
8import org.springframework.web.bind.annotation.PathVariable;
9import org.springframework.web.bind.annotation.PostMapping;
10import org.springframework.web.bind.annotation.RequestParam;
11
12@Controller
13@AllArgsConstructor
14public 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.