Ejemplo n.º 1
0
        public ActionResult UsersGenderCount(UsersGenderCountModel model)
        {
            DateTime? fromDate = this.TryParseDateTime(model.DateFrom);
            DateTime? toDate = this.TryParseDateTime(model.DateTo);

            IList<UsersGenderCount> genders = this._repositoryService.GetUsersGenderCount(fromDate: fromDate, toDate: toDate);
            this.PrepareUsersGenderCountModel(model, genders);

            return View(model);
        }
Ejemplo n.º 2
0
        private void PrepareUsersGenderCountModel(UsersGenderCountModel model, IList<UsersGenderCount> genders)
        {
            model = model ?? new UsersGenderCountModel();

            if (!genders.IsEmpty())
            {
                StringBuilder sbPie = new StringBuilder(@"[");

                foreach (UsersGenderCount g in genders)
                {
                    g.Gender = HttpUtility.JavaScriptStringEncode(string.Format("{0} ({1})", g.Gender, g.Count));

                    sbPie.AppendFormat(@"['{0}', {1}],", g.Gender, g.Count);
                }

                sbPie.Append(@"]");

                model.JsonPie = sbPie.ToString();
            }
        }
Ejemplo n.º 3
0
        public ActionResult UsersGenderCount()
        {
            DateTime fromDate = new DateTime(2000, 1, 1);
            DateTime toDate = DateTime.Today;
            UsersGenderCountModel model = new UsersGenderCountModel()
            {
                DateFrom = fromDate.ToShortDateString(),
                DateTo = toDate.ToShortDateString()
            };

            IList<UsersGenderCount> genders = this._repositoryService.GetUsersGenderCount(fromDate: fromDate, toDate: toDate);
            this.PrepareUsersGenderCountModel(model, genders);

            return View(model);
        }