Пример #1
0
        public JsonResult GetCharts(DateTime StartDate, DateTime EndDate)
        {
            var res    = dashboardData.GetChartData(SessionData.UserID, StartDate, EndDate);
            var gmodel = new GraphModel();

            if (res.Count > 0)
            {
                gmodel.spendmodel = res.Select(s => new SpendModel()
                {
                    ReportDay = s.ReportDay,
                    Spend     = s.Spend
                }).ToList();
                gmodel.salemodel = res.Select(r => new SalesModel()
                {
                    ReportDay = r.ReportDay,
                    Sales     = r.Sales
                }).ToList();
                gmodel.acosmodel = res.Select(a => new AcosModel()
                {
                    ReportDay = a.ReportDay,
                    Sales     = a.Sales,
                    Spend     = a.Spend
                }).ToList();
                gmodel.impressions = res.Select(i => new ImpressionModel()
                {
                    ReportDay   = i.ReportDay,
                    Impressions = i.Impressions
                }).ToList();
                gmodel.clicks = res.Select(i => new ClickModel()
                {
                    ReportDay = i.ReportDay,
                    Clicks    = i.Click
                }).ToList();

                gmodel.ctr = res.Select(i => new CTRModel()
                {
                    ReportDay   = i.ReportDay,
                    Impressions = i.Impressions,
                    Clicks      = i.Click
                }).ToList();
                gmodel.cpc = res.Select(i => new CPCModel()
                {
                    ReportDay = i.ReportDay,
                    Spend     = i.Spend,
                    Clicks    = i.Click
                }).ToList();
            }
            return(Json(gmodel, JsonRequestBehavior.AllowGet));
        }