public string CheckStudentFavoriteCourse(long studentId, long courseId) { Student student = _repository.GetById(studentId); if (student == null) { return("Student not found"); } Course course = Course.FromId(courseId); if (course == null) { return("Course not found"); } return(student.FavoriteCourse == course ? "Yes" : "No"); }
public string EnrollStudent(long studentId, long courseId, Grade grade) { Student student = _studentRepo.GetById(studentId); if (student == null) { return("Student not found"); } Course course = Course.FromId(courseId); if (course == null) { return("Course not found"); } var result = student.EnrollIn(course, grade); _contex.SaveChanges(); return(result); }