示例#1
0
        public ActionResult GetCounts()
        {
            var refusedCount   = repo.GetCandidateCountByStatus(Status.Refused);
            var confirmedCount = repo.GetCandidateCountByStatus(Status.Confirmed);
            var pendingCount   = repo.GetCandidateCountByStatus(Status.Pending);

            return(Json(new { Refused = refusedCount, Confirmed = confirmedCount, Pending = pendingCount }, JsonRequestBehavior.AllowGet));
        }
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            CandidatesRepository repo = new CandidatesRepository(Properties.Settings.Default.ConStr);

            filterContext.Controller.ViewBag.Confirmed = repo.GetCandidateCountByStatus(Status.Confirmed);
            filterContext.Controller.ViewBag.Pending   = repo.GetCandidateCountByStatus(Status.Pending);
            filterContext.Controller.ViewBag.Refused   = repo.GetCandidateCountByStatus(Status.Refused);
            base.OnActionExecuting(filterContext);
        }