예제 #1
0
        public ActionResult GetReportsGraph(int year = 0)
        {
            if (year == 0)
            {
                return(Json(null));
            }
            var states = _reportLogic.GetReportGraph(year);
            List <ReportGraphViewModel> results = new List <ReportGraphViewModel>();

            var medias = states.Select(c => c.Origin).Distinct().ToList();

            foreach (var item in medias)
            {
                ReportGraphViewModel result = new ReportGraphViewModel();
                result.Media = item;
                result.Total = states.Where(c => c.Origin.Equals(item)).Count();
                results.Add(result);
            }
            return(Json(results));
        }