public string GetResult()
        {
            BarChart chart  = new BarChart();
            var      result = VotesController.votes.GroupBy(v => v.Candidate_id, (key, group) => new { candidate_id = key, count = group.ToList().Count });

            chart.addColumn("string", "Candidate");
            chart.addColumn("number", "Ratings");

            foreach (var item in result)
            {
                var candidate = CandidatesController.candidates.
                                Where(c => c.Id == item.candidate_id).FirstOrDefault();
                if (candidate != null)
                {
                    chart.addRowJson(candidate.Name, item.count.ToString());
                }
            }

            return(chart.JSon());
        }
        public async Task <string> GetResultAsync()
        {
            BarChart    chart  = new BarChart();
            List <Vote> votess = await _votesService.GetVotesList();

            List <Candidate> candidatess = await _candidatesService.GetCandidatesList();

            var result = votess.GroupBy(v => v.Candidate_id, (key, group) => new { candidate_id = key, count = group.ToList().Count });

            chart.addColumn("string", "Candidate");
            chart.addColumn("number", "Ratings");

            foreach (var item in result)
            {
                var candidate = candidatess.
                                Where(c => c.Id == item.candidate_id).FirstOrDefault();
                if (candidate != null)
                {
                    chart.addRowJson(candidate.Name, item.count.ToString());
                }
            }
            return(chart.JSon());
        }