Esempio n. 1
0
        public async Task <long> InsertCourseByUserIdAsync(long userId, Course course)
        {
            if (userId < 0)
            {
                throw new ArgumentException();
            }

            //根据userId找出teacher
            var teacher = await _iUserService.GetUserByUserIdAsync(userId); //会抛出ArgumentException和UserNotFoundException

            course.Teacher = teacher;
            var courseId = await _iCourseDao.InsertCourseByUserIdAsync(course);

            return(courseId);
        }