Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Student-Marks-Microservice
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kyle Muldoon
Student-Marks-Microservice
Commits
3142ec8f
Commit
3142ec8f
authored
Apr 02, 2021
by
Vishal Vaddadhi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'get' into 'master'
Implements findAll and findById See merge request
!3
parents
6839e7e8
26c47489
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
StudentMarksController.java
...vices/MarksService/controller/StudentMarksController.java
+15
-2
StudentService.java
.../StudentServices/MarksService/service/StudentService.java
+3
-1
No files found.
src/main/java/com/StudentServices/MarksService/controller/StudentMarksController.java
View file @
3142ec8f
...
@@ -3,6 +3,7 @@ package com.StudentServices.MarksService.controller;
...
@@ -3,6 +3,7 @@ package com.StudentServices.MarksService.controller;
import
com.StudentServices.MarksService.model.StudentMarks
;
import
com.StudentServices.MarksService.model.StudentMarks
;
import
com.StudentServices.MarksService.service.StudentService
;
import
com.StudentServices.MarksService.service.StudentService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -17,7 +18,10 @@ public class StudentMarksController {
...
@@ -17,7 +18,10 @@ public class StudentMarksController {
@Autowired
StudentService
studentService
;
@Autowired
StudentService
studentService
;
// (GET) findall studentmarks
// (GET) findall studentmarks
@GetMapping
ResponseEntity
<
List
<
StudentMarks
>>
findAllStudentMarks
(){
return
ResponseEntity
.
ok
(
studentService
.
findAllStudents
());
}
// (POST) create studentmark
// (POST) create studentmark
@PostMapping
(
"/studentMarks"
)
@PostMapping
(
"/studentMarks"
)
public
ResponseEntity
<
StudentMarks
>
createMarks
(
@RequestBody
StudentMarks
studentMarks
)
{
public
ResponseEntity
<
StudentMarks
>
createMarks
(
@RequestBody
StudentMarks
studentMarks
)
{
...
@@ -26,7 +30,16 @@ public class StudentMarksController {
...
@@ -26,7 +30,16 @@ public class StudentMarksController {
}
}
// (GET) find studentmark by id
// (GET) find studentmark by id
@GetMapping
ResponseEntity
<
StudentMarks
>
findStudentMarksById
(
String
id
){
StudentMarks
sm
=
studentService
.
getStudentById
(
id
);
if
(
sm
==
null
){
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_FOUND
);
}
else
{
return
ResponseEntity
.
ok
(
sm
);
}
}
// (PUT) update studentmark by id
// (PUT) update studentmark by id
// (DELETE) delete studentmark by id
// (DELETE) delete studentmark by id
...
...
src/main/java/com/StudentServices/MarksService/service/StudentService.java
View file @
3142ec8f
...
@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
@Service
@Service
public
class
StudentService
{
public
class
StudentService
{
...
@@ -27,7 +28,8 @@ public class StudentService {
...
@@ -27,7 +28,8 @@ public class StudentService {
}
}
public
StudentMarks
getStudentById
(
String
ID
)
{
public
StudentMarks
getStudentById
(
String
ID
)
{
return
null
;
Optional
<
StudentMarks
>
sm
=
studentRepository
.
findById
(
ID
);
return
sm
.
orElse
(
null
);
}
}
public
void
updateStudent
(
StudentMarks
studentMarks
)
{
public
void
updateStudent
(
StudentMarks
studentMarks
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment