Exemplo n.º 1
0
        public async Task <IActionResult> AddReaction(string questionID, string postId, int postType, int reactionType)
        {
            if (!((postType == 0 || postType == 1) && (reactionType == 0 || reactionType == 1)))
            {
                return(BadRequest());
            }
            var user = await questionsRepository.getUserByUserName(User.Identity.Name);

            await reactionRepository.AddReactionFromPost(user.Id, int.Parse(postId), (PostType)postType, (ReactionType)reactionType);

            return(RedirectToAction("Details", new { id = int.Parse(questionID) }));
        }