public IActionResult Delete(int studentId, int courseId) { var mark = marksRepository.GetById(studentId, courseId); if (mark == null) { return(NotFound("Mark does not exist for this student.")); } marksRepository.Delete(mark); marksRepository.Save(); return(new NoContentResult()); }
public void Delete(int id) { var marks = _markRepository.GetAllBy(i => i.StudentId == id).ToList(); //var mark = _markRepository.GetFirstValue(markObj.Id); foreach (var mark in marks) { var result = _markRepository.Delete(mark); } var subjects = _subjectRepository.GetAllBy(i => i.StudentId == id).ToList(); foreach (var subject in subjects) { //var subject = _subjectRepository.GetFirstValue(subjectObj.Id); _subjectRepository.Delete(subject); } var students = _studentRepository.GetAllBy(i => i.Id == id).ToList(); //var student = _studentRepository.GetFirstValue(studentObj.Id); foreach (var student in students) { _studentRepository.Delete(student); } }