コード例 #1
0
        public IEnumerable <QuestionDto> GetDoneOrTodoList(bool isDone)
        {
            IEnumerable <QuestionDto> results        = null;
            List <Question>           doneOrTodoList = null;

            try
            {
                CandidateQuestionsRepository repository = new CandidateQuestionsRepository(_appDbContext);
                var candidateQuestions = repository.Get(isDone, _clientData.ChildId);

                doneOrTodoList = candidateQuestions.Select(q => q.Question).ToList();

                results = _mapper.Map <IEnumerable <Question>, IEnumerable <QuestionDto> >(doneOrTodoList);

                results = new QuestionsRepository(_appDbContext).IncludeSkills(results);
            }
            catch (Exception e)
            {
                _log.LogError(e, "Error getting done/todo list");
            }

            return(results);
        }
コード例 #2
0
        public CandidateDashboardData GetCandidateDashboardData()
        {
            var candidateDashbaordData = new CandidateDashboardData();

            try
            {
                var questionsRepository          = new QuestionsRepository(_appDbContext);
                var candidateQuestionsRepository = new CandidateQuestionsRepository(_appDbContext);

                candidateDashbaordData.NumOfQuestions     = questionsRepository.GetPublicQuestionsCount();
                candidateDashbaordData.TodoListQuestions  = Mapper.Map <IEnumerable <QuestionDto> >(candidateQuestionsRepository.Get(false, _clientData.ChildId).Select(cq => cq.Question).Take(Consts.DASHBOARD_DATA_TODO_LIST_COUNT));
                candidateDashbaordData.PublishedQuestions = Mapper.Map <IEnumerable <QuestionDto> >(questionsRepository.Find(p => p.CreatedBy == _clientData.Id).Take(Consts.DASHBOARD_DATA_PUBLISHED_QUESTIONS_COUNT).OrderByDescending(q => q.DateCreated));

                candidateDashbaordData.TodoListQuestions  = questionsRepository.IncludeSkills(candidateDashbaordData.TodoListQuestions);
                candidateDashbaordData.PublishedQuestions = questionsRepository.IncludeSkills(candidateDashbaordData.PublishedQuestions);
            }
            catch (Exception e)
            {
                _log.LogError(e, "Error in GetCandidateDashboardData()");
            }
            return(candidateDashbaordData);
        }