app/controllers/StudentCourseController.java
/**
     * apply course form functionality
     * @param courseId
     * @return
     */
apply course form functionality
@param courseId
@return
apply course form functionality @param courseId @return
@Security.Authenticated(Secured.class)
    public static Result apply(Long courseId) {
        Course course = Course.findById(courseId);
        String userName = session("studentUsername");
        Form<StudentCourseDto> form = form(StudentCourseDto.class);
        if (StringUtils.isNotBlank(userName)) {
            Student student = Student.findByStudentUsername(userName);
            StudentCourseDto studentCourseForm = StudentTransformer.fillStudentToForm(student);
            studentCourseForm.setCourseId(courseId);
            form = form.fill(studentCourseForm);
        }
        return ok(apply.render(form, Course.findGeneral(), Course.findExamPrep(), Course.findAcYear()));
    }
@ Security . Authenticated ( Secured . class ) public static Result apply ( Long courseId ) { Course course = Course . findById ( courseId ) ; String userName = session ( "studentUsername" ) ; Form < StudentCourseDto > form = form ( StudentCourseDto . class ) ; if ( StringUtils . isNotBlank ( userName ) ) { Student student = Student . findByStudentUsername ( userName ) ; StudentCourseDto studentCourseForm = StudentTransformer . fillStudentToForm ( student ) ; studentCourseForm . setCourseId ( courseId ) ; form = form . fill ( studentCourseForm ) ; } return ok ( apply . render ( form , Course . findGeneral ( ) , Course . findExamPrep ( ) , Course . findAcYear ( ) ) ) ; }
apply course form functionality
 @param courseId
 @return
apply course form functionality @param courseId @return
//Find the course by id from db //check if user is logged in, if yes then fill form with student details to be rendered in UI //render apply registration form