Example #1
0
        public async Task <ActionResult <UsersProgressResponse> > Visit([FromRoute] Course course, [FromRoute] Guid slideId)
        {
            var isInstructor = await courseRolesRepo.HasUserAccessToCourseAsync(UserId, course.Id, CourseRoleType.Instructor).ConfigureAwait(false);

            var slide = course.FindSlideById(slideId, isInstructor);

            if (slide == null)
            {
                var instructorNote = course.FindInstructorNoteById(slideId);
                if (instructorNote != null && isInstructor)
                {
                    slide = instructorNote.Slide;
                }
            }
            if (slide == null)
            {
                return(StatusCode((int)HttpStatusCode.NotFound, $"No slide with id {slideId}"));
            }
            await visitsRepo.AddVisit(course.Id, slideId, UserId, GetRealClientIp());

            return(await UserProgress(course.Id, new UserProgressParameters()));
        }
Example #2
0
        public async Task <ActionResult <UserProgressResponse> > Visit([FromRoute] Course course, [FromQuery] Guid slideId)
        {
            await visitsRepo.AddVisit(course.Id, slideId, UserId, GetRealClientIp());

            return(await UserProgress(course));
        }