Skip to content
Snippets Groups Projects
Commit 33441bf0 authored by Annika Geßmann's avatar Annika Geßmann
Browse files

Controller dev

parent 35d6f93f
Branches TabelleAnpassung
No related tags found
1 merge request!2Tabelle anpassung
......@@ -5,6 +5,7 @@ import org.springframework.data.repository.Repository;
import org.springframework.web.bind.annotation.*;
import thinkTogether.groupManagement.model.Group;
import java.util.ArrayList;
import java.util.List;
......@@ -20,24 +21,30 @@ public class GroupManagementController implements iGroupService {
return "Hello from the GroupManagement Controller!";
}
@Autowired
public GroupManagementController(Repository repository){
this.repository = (thinkTogether.groupManagement.repo.iGroupRepository) repository;
}
//@Autowired
//public GroupManagementController(Repository repository){
// this.repository = (thinkTogether.groupManagement.repo.iGroupRepository) repository;
//}
@RequestMapping(value="/groups")
//@RequestMapping(value="/groups")
@Override
public List<Group> findAll() {
return repository.findAll();
List<Group> actual = repository.findAll();
// List<Group> gruppen = new ArrayList<Group>();
// actual.forEach(element -> gruppen.add(element));
return actual;
}
@RequestMapping(value = "/groups/{id}", method = RequestMethod.GET)
//@RequestMapping(value = "/groups/{id}", method = RequestMethod.GET)
@Override
public Group findByID(@RequestParam(value = "id")int id) {
public Group findByID(@PathVariable("ID") int id) {
return repository.findByID(id);
}
//@GetMapping("/groups/{id}")
//public Group getGroupById(@PathVariable(value = "group_ID") long group_ID) {
// Group group = repository.findOne(group_ID);
......
......@@ -9,6 +9,5 @@ import java.util.List;
public interface iGroupService {
public List<Group> findAll();
public Group findByID(int id);
}
......@@ -12,7 +12,7 @@ import java.util.List;
@Service
public interface iGroupRepository extends Repository<Group, Integer> {
public List<Group> findAll();
public Group findByID(int iD);
public Group findByID(int ID);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment