public CandidateQuestionDto UpdateQuestionReview(ReviewQuestionData reviewData, int candidateId) { var candidateQuestion = base.GetSingleOrDefault(cq => cq.IsDone && cq.CandidateUserId == candidateId && cq.QuestionId == reviewData.QuestionId); if (candidateQuestion == null) { throw new Exception($"Question {reviewData.QuestionId} with CandidateId {candidateId} was not found"); } candidateQuestion.Review = reviewData.Review; candidateQuestion.Ranked = reviewData.Rank; base.Update(candidateQuestion); _context.SaveChanges(); return(Mapper.Map <CandidateQuestionDto>(candidateQuestion)); }
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); }