public async Task <ActionResult> Vote(AnswerVoteRequest request, CancellationToken cancel) { var command = new AnswerVoteCommand(request.QuestionId, request.AnswerId, request.Upvote); var result = await _mediator.ExecuteAsync <AnswerVoteCommand, AnswerVoteCommandResult>(command, User.GetAppIdentity(), cancel); return(Json(new { Votes = result.Votes })); }
private void VoteAnswer(SimpleQAIdentity user, String questionId, String answerId) { var command = new AnswerVoteCommand(questionId, answerId, true); var result = _mediator.ExecuteAsync <AnswerVoteCommand, AnswerVoteCommandResult>(command, user, CancellationToken.None).Result; }