public async Task VoteAnswer(int answerId, bool isUpvote, int userId) { var answer = await _answerRepository.GetByIdAsync(answerId); if (isUpvote) { answer.Votes++; } else { answer.Votes--; } await _userAnswerRepository.CreateAsync(new UserAnswer() { IsUpvote = isUpvote, AnswerId = answerId, UserId = userId }); _answerRepository.Update(answer); await _unitOfWork.Commit(); }