コード例 #1
0
        /// <summary>
        /// Returns the currently selected contents by the user
        /// </summary>
        /// <param name="user">The user to look for it's contents</param>
        /// <returns>List of ContentCheck by whether the content are selected or not</returns>
        private async Task <List <ContentCheck> > GetContentChecksOfUser(AppUser user)
        {
            var result           = new List <ContentCheck>();
            var selectedContents = await _studentService.GetUserSelectedContentsAsync(user);

            foreach (var content in await _contentsService.GetContentsAsync())
            {
                result.Add(new ContentCheck()
                {
                    Content   = content,
                    isChecked = selectedContents.Any(c => c.Id == content.Id)
                });
            }
            return(result.Shuffle());
        }