public ActionResult PrintTopContributorsReport(int projectId) { var project = _dataManager.FindProjectById(projectId); if (project == null) { return(HttpNotFound()); } TopContributorsReportBuilder builder = new TopContributorsReportBuilder(_dataManager); List <UserContribution> contributionList = builder.CalculateUserContributions(project); List <UserContributionViewModel> viewModels = new List <UserContributionViewModel>(); contributionList.ForEach(contribution => viewModels.Add(Mapper.Map <UserContributionViewModel>(contribution))); TopContributorsReportViewModel model = new TopContributorsReportViewModel() { ProjectName = project.Name, ProjectId = project.Id, UserContributionList = viewModels, HideGenerate = true }; var action = new Rotativa.ViewAsPdf("Reports/_partialTopContributorReport", model: model) { FileName = "Project Summary.pdf" }; return(action); }
public ActionResult Reports(int projectId) { var project = _dataManager.FindProjectById(projectId); if (project == null) { return(HttpNotFound()); } TopContributorsReportBuilder builder = new TopContributorsReportBuilder(_dataManager); List <UserContribution> contributionList = builder.CalculateUserContributions(project); List <UserContributionViewModel> viewModels = new List <UserContributionViewModel>(); contributionList.ForEach(contribution => viewModels.Add(Mapper.Map <UserContributionViewModel>(contribution))); TopContributorsReportViewModel topContributorsReportViewModel = new TopContributorsReportViewModel() { ProjectName = project.Name, ProjectId = project.Id, UserContributionList = viewModels }; List <SprintStatusModel> sprintStatusModelList = new List <SprintStatusModel>(); SprintStatusReportBuilder statusReportBuilder = new SprintStatusReportBuilder(_dataManager); project.SprintList.ForEach(sprint => { SprintStatusModel sprintStatusModel = statusReportBuilder.BuildSprintStatus(sprint.Id); sprintStatusModelList.Add(sprintStatusModel); }); List <SprintStatusReportViewModel> sprintStatusReportViewModelList = Mapper.Map <List <SprintStatusReportViewModel> >(sprintStatusModelList); OverrallReportViewModel model = new OverrallReportViewModel() { TopContributorsReportViewModel = topContributorsReportViewModel, SprintStatusReportViewList = sprintStatusReportViewModelList }; return(View("Reports/Reports", model)); }