From 20e2cc9ea0c66e19a9125e5fb2c5c6359b21848a Mon Sep 17 00:00:00 2001 From: Filip Izydorczyk Date: Mon, 24 Aug 2020 11:36:15 +0200 Subject: [PATCH] removed symbol --- .../controllers/CoursesController.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/restservice/src/main/java/com/plannaplan/controllers/CoursesController.java b/restservice/src/main/java/com/plannaplan/controllers/CoursesController.java index 9c600be..bc01b99 100644 --- a/restservice/src/main/java/com/plannaplan/controllers/CoursesController.java +++ b/restservice/src/main/java/com/plannaplan/controllers/CoursesController.java @@ -1,5 +1,8 @@ package com.plannaplan.controllers; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.Hashtable; import java.util.List; import com.plannaplan.entities.Course; @@ -19,8 +22,17 @@ public class CoursesController { private CourseService courseService; @GetMapping("/getCourses") - public ResponseEntity> getMethodName() { - return new ResponseEntity<>(this.courseService.getAllCourses(), HttpStatus.OK); + public ResponseEntity>> getMethodName() { + List courses = this.courseService.getAllCourses(); + List> response = new ArrayList<>(); + for(Course c : courses){ + Dictionary element = new Hashtable<>(); + element.put("id", c.getId()); + element.put("name",c.getName()); + response.add(element); + } + + return new ResponseEntity<>(response, HttpStatus.OK); } } \ No newline at end of file