public CandidateQuestionDto PostSolution([FromBody] SolutionQuestionData obj) { CandidateQuestionDto result = null; try { // Post the question solution CandidateQuestionsRepository cqRepository = new CandidateQuestionsRepository(_appDbContext); result = cqRepository.UpdateQuestionSolution(obj, _clientData.ChildId); // Increment number of solves count QuestionsRepository questionsRepository = new QuestionsRepository(_appDbContext); questionsRepository.IncrementSolvedCount(obj.QuestionId); } catch (Exception e) { _log.LogError(e, "Error posting the solution"); } return(result); }
public CandidateQuestionDto PostReview([FromBody] ReviewQuestionData obj) { CandidateQuestionDto result = null; try { // Post the question review CandidateQuestionsRepository cqRepository = new CandidateQuestionsRepository(_appDbContext); result = cqRepository.UpdateQuestionReview(obj, _clientData.ChildId); // Update the Rank of the question QuestionsRepository questionsRepository = new QuestionsRepository(_appDbContext); questionsRepository.UpdateRank(obj.QuestionId, obj.Rank); } catch (Exception e) { _log.LogError(e, "Error posting the review"); } return(result); }
public CandidateQuestionDto GetCandidateQuestion(int questionId) { CandidateQuestionDto result = null; try { CandidateQuestionsRepository repository = new CandidateQuestionsRepository(_appDbContext); var candidateQuestion = repository.GetSingleOrDefault(cq => cq.QuestionId == questionId && cq.CandidateUserId == _clientData.ChildId); if (candidateQuestion != null) { result = _mapper.Map <CandidateQuestionDto>(candidateQuestion); } } catch (Exception e) { _log.LogError(e, "Error getting candidate question"); } return(result); }