public IActionResult Get(int articleId)
        {
            IEnumerable <Vote> votes = voteRepository.GetArticle(articleId);

            if (votes.Count() == 0)
            {
                return(BadRequest("No votes."));
            }

            return(Ok(new VoteResultViewModel()
            {
                Percentage = (100 / votes.Count()) * votes.Where(vote => vote.Rating == 1).Count(),
                Count = votes.Count()
            }));
        }
        private void Consumer_RabbitReceived(RabbitMqMessage message, string consumer)
        {
            switch (message.Action)
            {
            case RabbitMqAction.Delete:
                int articleId            = int.Parse(message.Data.ToString());
                IEnumerable <Vote> votes = voteRepository.GetArticle(articleId);

                foreach (Vote vote in votes)
                {
                    voteRepository.Delete(vote.Id);
                }

                Console.WriteLine("RabbitMQ: " + votes.Count() + " votes Deleted.");
                break;

            default:
                Console.WriteLine("Unknown RabbitMQ Message.");
                break;
            }
        }