Example #1
0
        public ActionResult GraficVoting(string NumberContract)
        {
            try
            {
                List <ProposalModel> list = null;
                using (ProposalDataAccess proposalDataAccess = new ProposalDataAccess())
                {
                    list = proposalDataAccess.SearchProposal(NumberContract, null);
                }

                List <DataPointModel> dataPoints  = new List <DataPointModel>();
                ProposalBussiness     porpBisness = new ProposalBussiness();

                List <OptionModel> options = porpBisness.ConsultPartialResults(list[0]);
                foreach (var item in options)
                {
                    dataPoints.Add(new DataPointModel(0, item.NumberOfVotes, item.Description, item.Description + "=" + item.NumberOfVotes.ToString()));
                }

                List <VotesModel> Votes = porpBisness.SearchVotes(list[0].ContracEthereumProposal);

                string DatoSource = "[";
                foreach (DataPointModel item in dataPoints)
                {
                    string dat = " y:{0}, legendText: \"{1}\", indexLabel: \"{2}\"";
                    DatoSource += "{" + string.Format(dat, item.y.ToString(), item.legendText, item.indexLabel) + "},";
                }
                DatoSource         += "]";
                ViewBag.DataPoints  = DatoSource;// System.Web.WebPages.Html.Raw( JsonConvert.SerializeObject(dataPoints).Replace(@"""", @""));
                ViewBag.Description = "\"" + list[0].ProposalName + "\"";
                ViewBag.Proposal    = list[0];
                ViewBag.Votes       = Votes;
                return(View());
            }
            catch (Exception)
            {
                return(RedirectToAction("ProposalList", "Proposal"));
            }
        }
Example #2
0
        public List <OptionModel> ConsultPartialResults(ProposalModel filter)
        {
            ProposalBussiness bussiness = new ProposalBussiness();

            return(bussiness.ConsultPartialResults(filter));
        }