public ActionResult Vote(string key) { var repo = new VoteRepository(); repo.AddVote(key); return(RedirectToAction("Index", "Home")); }
public IActionResult AddVote([FromBody] JObject data) { int UserId = data["userId"].ToObject <int>(); int PostId = data["postId"].ToObject <int>(); VoteType voteType = data["vote"].ToObject <VoteType>(); Vote vote = new Vote(); vote.UserId = UserId; vote.PostId = PostId; vote.VoteType = voteType; return(Ok(_voteRepository.AddVote(vote))); }