Exemple #1
0
        public async Task <bool> SignUpToCourseAsync(int studentId, int courseId)
        {
            var student = await _studentRepository.GetByIdAsync(studentId);

            var course = await _courseRepository.GetByIdAsync(courseId);

            return(await _courseRepository.AddStudentAsync(course, student));
        }
Exemple #2
0
        public async Task <ActionResult> AddStudent(long courseId, long studentId)
        {
            await repository.AddStudentAsync(courseId, studentId);

            return(CreatedAtAction(nameof(AddStudent), new { courseId, studentId }, null));
        }