コード例 #1
0
        public void Upvote(QuestionUpvote questionUpvote)
        {
            var voteExists = Db.FirstOrDefault <Models.DataModels.QuestionUpvote>("WHERE [UserId] = @0 AND [QuestionId] = @1", questionUpvote.UserId, questionUpvote.QuestionId);

            if (voteExists == null)
            {
                var newVote = new Models.DataModels.QuestionUpvote
                {
                    UserId     = questionUpvote.UserId,
                    QuestionId = questionUpvote.QuestionId
                };
                Db.Insert("QuestionUpVotes", newVote);
            }
        }
コード例 #2
0
 public void Upvote([FromBody] QuestionUpvote questionUpvote)
 {
     QuestionService.Upvote(questionUpvote);
 }