/// <summary>
        /// Create bookmarks
        /// </summary>
        /// <returns></returns>
        private async Task EnsureBookmarkAsync()
        {
            var user = await _userRepository.GetUserByEmail("*****@*****.**");

            var bookmarks = await _bookmarkedCourseRepository.GetBookmarkedCoursesForUser(user.Id);

            if (bookmarks.Count == 0)
            {
                var course = await _courseRepository.GetCourseByCode("Illuminate Lms 101");

                var bookmark = new BookmarkedCourse
                {
                    User   = user,
                    Course = course
                };
                await _bookmarkedCourseRepository.CreateBookmark(bookmark);
            }
        }
Example #2
0
        /// <summary>
        /// Get all bookmarked courses for user
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public async Task <List <BookmarkedCourse> > GetBookmarkedCoursesForUser(long userId)
        {
            var results = await _bookmarkedCourseRepository.GetBookmarkedCoursesForUser(userId);

            return(results.Select(_mapper.Map <BookmarkedCourse>).ToList());
        }