Example #1
0
        public async Task <IActionResult> AddCourse(int courseId)
        {
            var course = _data.GetFullCourse(courseId);

            var userId = User.GetUserId();

            var user = _userData.GetUserWithStats(userId);


            user.CourseStatistics.Add(CreateStatisticsForCourse(course));

            _userData.UpdateUser(user);

            _userData.AddCourseToUser(course, user);


            return(RedirectToAction("Details", "Course", new { id = courseId }));
        }