Commit 9d5a9bc3 authored by Kyle Muldoon's avatar Kyle Muldoon

updated delete route on controller and service

parent 787f79e7
...@@ -42,10 +42,15 @@ public class StudentMarksController { ...@@ -42,10 +42,15 @@ public class StudentMarksController {
// (PUT) update studentmark by id // (PUT) update studentmark by id
// (DELETE) delete studentmark by id // (DELETE) delete studentmark by id
// @DeleteMapping("remove/{id}") @DeleteMapping("remove/{id}")
// ResponseEntity<StudentMarks> deleteStudentMarkById(@PathVariable String id) { ResponseEntity<String> deleteStudentMarkById(@PathVariable String id) throws ResourceNotFoundException{
// StudentMarks sm = studentService.getStudentById(id) StudentMarks sm = studentService.getStudentById(id).
// } orElseThrow( () -> new ResourceNotFoundException("Student Marks not found... " + id));
studentService.deleteStudent(sm);
return ResponseEntity.ok("Successfully deleted student: " + sm.getEmailAddress());
}
////////////////////////////////// //////////////////////////////////
......
...@@ -37,9 +37,7 @@ public class StudentService { ...@@ -37,9 +37,7 @@ public class StudentService {
} }
public void deleteStudent(StudentMarks StudentMarks) { public void deleteStudent(StudentMarks studentMarks) { studentRepository.delete(studentMarks); }
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment