public ActionResult Display(ReportDisplayViewModel model) { if (_authorizer.Authorize(reportManager.GetReportPermissions()[model.Id]) == false) { return(new HttpUnauthorizedResult(T("Not authorized to list Reports").ToString())); } var ci = services.ContentManager.Get(model.Id); if (ci.Has <DataReportViewerPart>() == false) { throw new ArgumentException(string.Format(CultureInfo.CurrentUICulture, "{0}={1}", T("There is no report with the Id"), model.Id.ToString(CultureInfo.InvariantCulture))); } var filterPart = ci.Parts.FirstOrDefault(x => x.PartDefinition.Name == ci.ContentType); if (filterPart != null) { model.FilterContent = services.ContentManager.New("DataReportEmptyType"); model.FilterContent.Weld(filterPart); } else { model.ViewerContent = services.ContentManager.New("DataReportEmptyType"); model.ViewerContent.Weld(ci.As <DataReportViewerPart>()); } return(View(model)); }
public IActionResult Reports(int?page) { if (!page.HasValue) { page = 1; } ReportDisplayViewModel viewModel = new ReportDisplayViewModel { Reports = this.reportService.GetAllPostReports <ReportViewModel>(page), CurrentPage = (int)page, PagesCount = (int)Math.Ceiling(this.reportService.GetReportCount() / GlobalConstants.ItemsPerPage), }; return(this.View(viewModel)); }