Exemplo n.º 1
0
        public void AddQuizToFavourite(string userId, string quizId)
        {
            var user = userFactory.CreateUserWithId(userId);
            var quiz = quizDTOMapper.Create(quizId);

            quiz.AddToFavouritesUsers(user);
        }
Exemplo n.º 2
0
        private List <ApplicationUserDTO> CreateAssignedQuizUsers(string quizId, Data.Entities.AssignType type)
        {
            var users = applicationUserRepository.Users.
                        Where(
                u => u.AssignedUsers.
                Any(a => a.AssignType == type && a.QuizId.Equals(quizId))
                ).ToList();
            List <ApplicationUserDTO> usersDTO = new List <ApplicationUserDTO>();

            if (users.Count == 0)
            {
                return(usersDTO);
            }
            foreach (var u in users)
            {
                usersDTO.Add(userDTOMapper.CreateUserWithId(u.Id));
            }
            return(usersDTO);
        }