Exemplo n.º 1
0
        public IActionResult RemoveUpvote(int id)
        {
            var token = HttpContext.Request.Cookies["user-token"];

            var myprofile = _profileRepository.GetUserByToken(token);

            var reaction = _reactionRepository.FindReaction(myprofile.Id, id);


            _reactionRepository.RemoveReaction(reaction);


            var notifyToDelete = _reactionRepository.GetNotificationByReaction($"{this.Request.Scheme}://{this.Request.Host}{this.Request.PathBase}/post/index/" + id, myprofile.FullName);

            if (notifyToDelete == null)
            {
                return(Ok());
            }

            _reactionRepository.RemoveNotify(notifyToDelete);


            return(Ok(notifyToDelete));
        }