public ActionResult <Vote> AddVote(int id, VoteDTO vote) { var user = _userRepository.GetById(vote.UserId); if (user == null) { return(NotFound()); } Vote newVote = new Vote(user, vote.VoteType); _postRepository.AddVote(id, newVote); _postRepository.SaveChanges(); return(Ok(newVote)); }