Esempio n. 1
0
        public Probe GetProbeFromDay()
        {
            Probe Probe = XMLSerializerHelper.DeserializeProbeFromXML()
                          .First(x => x.PublicationDate == DateTime.Now.ToShortDateString());

            return(Probe);
        }
Esempio n. 2
0
        private ProbeViewModel GetProbeFormDay()
        {
            var            probeIsChecked = this.ControllerContext.HttpContext.Request.Cookies["ProbeChecked"];
            ProbeViewModel Probe          = XMLSerializerHelper.DeserializeProbeFromXML()
                                            .Select(x => new ProbeViewModel
            {
                Question        = x.Question,
                PublicationDate = x.PublicationDate,
                IsChecked       = probeIsChecked != null && x.PublicationDate == probeIsChecked.Value ? true : false,
                Answers         = x.Answers.Select(z => new AnswerViewModel
                {
                    Text          = z.Text,
                    Value         = int.Parse(z.Value),
                    ValueProgress = int.Parse(z.Value) != 0 ? (int)(int.Parse(z.Value) / (double)x.Answers.Sum(y => int.Parse(y.Value)) * 100): 0
                }).ToList(),
            }).First(x => x.PublicationDate == DateTime.Now.ToShortDateString());

            return(Probe);
        }