public ActionResult Index() { var today = DateTime.Today.AddYears(-1); var startDate = new DateTime(today.Year, today.Month, 1); var endDate = startDate.AddYears(1).AddDays(-1); var model = new ComparisonChartRequestModel { targetType = TargetType.CarbonEmissions, startDate = startDate, endDate = endDate }; return View(model); }
private ComparisonChartViewModel CreatePrintModel(ComparisonChartRequestModel request) { var model = service.CreateModel(request); model.request = request; foreach (var series in model.series.ToArray()) { var seriesRequest = new ComparisonSeriesRequestModel { activityId = series.activityId, costCode = series.costCode, endDate = request.endDate, startDate = request.startDate, target = series.target, targetType = request.targetType }; series.data = service.ComparisonData(seriesRequest).ToArray(); } return model; }
public ActionResult ComparisonChart(ComparisonChartRequestModel request) { var model = service.CreateModel(request); return Json(model, JsonRequestBehavior.AllowGet); }
public ActionResult PrintPdf(ComparisonChartRequestModel request) { var model = CreatePrintModel(request); return PrintResult.PrintToPdf("Print", model); }
public ComparisonChartViewModel CreateModel(ComparisonChartRequestModel request) { var model = new ComparisonChartViewModel { categories = Categories(request.startDate, request.endDate), series = ChartSeries(request.targetType).ToArray() }; return model; }