source: src/main/java/project/educatum/web/ClassController.java@ d3cf3a1

Last change on this file since d3cf3a1 was d3cf3a1, checked in by Marija Micevska <marija_micevska@…>, 23 months ago

Initial commit

  • Property mode set to 100644
File size: 1.1 KB
Line 
1package project.educatum.web;
2
3import org.springframework.stereotype.Controller;
4import org.springframework.web.bind.annotation.PathVariable;
5import org.springframework.web.bind.annotation.PostMapping;
6import org.springframework.web.bind.annotation.RequestMapping;
7import org.springframework.web.bind.annotation.RequestMethod;
8import project.educatum.repository.ClassRepository;
9import project.educatum.service.ClassService;
10import project.educatum.service.TeacherService;
11import project.educatum.service.SubjectService;
12import project.educatum.service.StudentService;
13
14@Controller
15@RequestMapping(path = "/raspored", method = {RequestMethod.POST, RequestMethod.DELETE, RequestMethod.GET})
16public class ClassController {
17
18 private final ClassRepository classRepository;
19
20 public ClassController(ClassRepository classRepository) {
21 this.classRepository = classRepository;
22 }
23
24 @PostMapping("/delete/{id}")
25 public String deleteClass(@PathVariable String id) {
26 classRepository.deleteById(Integer.valueOf(id));
27 return "redirect:/teachers/allClasses";
28 }
29
30}
Note: See TracBrowser for help on using the repository browser.