public async Task <RiskRegisterVM> RiskDetailsByProject(string projectId, string user) { RiskRegisterVM riskRegisterVm = new RiskRegisterVM(); List <RiskCategory> riskCategories = _ampRepository.GetRiskCategories().ToList(); List <RiskLikelihood> riskLikelihoods = _ampRepository.GetRiskLikelihoods().ToList(); List <RiskImpact> riskImpacts = _ampRepository.GetRiskImpacts().ToList(); List <Risk> riskRatings = _ampRepository.GetRisks().ToList(); RiskRegisterCollection projectRiskCollection = new RiskRegisterCollection(_ampRepository.GetRiskRegister(projectId)); if (projectRiskCollection.HasRiskItems()) { List <RiskRegister> projectRisks = projectRiskCollection.AllRisks().ToList(); RiskItemVMCollectionBuilder riskItemVmCollectionBuilder = new RiskItemVMCollectionBuilder(projectRiskCollection.AllRisks().ToList(), riskCategories, riskLikelihoods, riskImpacts, riskRatings); RiskItemsVM riskItemsVm = new RiskItemsVM(); riskItemsVm.projectRisks = riskItemVmCollectionBuilder.BuildRiskItemVMList(); riskRegisterVm.RiskItemsVm = riskItemsVm; } RiskDocumentCollection riskDocumentCollection = new RiskDocumentCollection(_ampRepository.GetRiskDocuments(projectId), _documentService); if (riskDocumentCollection.HasRiskDocuments()) { riskRegisterVm.RiskDocuments = riskDocumentCollection.CreateRiskDocumentsVM(); RiskDocumentVMCollectionBuilder riskDocumentVmCollectionBuilder = new RiskDocumentVMCollectionBuilder(riskDocumentCollection.AllRiskDocuments().ToList(), _documentService); RiskDocumentsVM riskDocumentsVm = new RiskDocumentsVM(); riskDocumentsVm.ProjectRiskDocuments = riskDocumentVmCollectionBuilder.BuildRiskDocumentVMList(); riskRegisterVm.RiskDocumentsVm = riskDocumentsVm; } // OverallRiskRatingCollection overallRiskCollection = new OverallRiskRatingCollection(_ampRepository.GetOverallRiskRatings(projectId)); if (overallRiskCollection.HasOverallRiskRating()) { riskRegisterVm.OverallRiskRatings = overallRiskCollection.CreateOverallRiskRatingVms(); OverallRiskRatingVMCollectionBuilder overallRiskratingVmCollectionBuilder = new OverallRiskRatingVMCollectionBuilder(overallRiskCollection.AllOverallRiskRatingsRisks().ToList(), riskRatings); OverallRiskRatingsVM overallRatingsVm = new OverallRiskRatingsVM(); overallRatingsVm.OverallRiskRatings = overallRiskratingVmCollectionBuilder.BuildOverallRiskRatingVMList(); riskRegisterVm.OverallRiskRatingsVm = overallRatingsVm; } riskRegisterVm.RiskCategoryValues = _ampRepository.GetRiskCategories().ToList(); riskRegisterVm.RiskLikelihoodValues = _ampRepository.GetRiskLikelihoods().ToList(); riskRegisterVm.RiskImpactValues = _ampRepository.GetRiskImpacts().ToList(); riskRegisterVm.RiskValues = _ampRepository.GetRisks().ToList(); riskRegisterVm.ProjectID = projectId; return(riskRegisterVm); }
public RiskItemsVM GetRiskTableData(string projectId, string user) { List <RiskCategory> riskCategories = _ampRepository.GetRiskCategories().ToList(); List <RiskLikelihood> riskLikelihoods = _ampRepository.GetRiskLikelihoods().ToList(); List <RiskImpact> riskImpacts = _ampRepository.GetRiskImpacts().ToList(); List <Risk> riskRatings = _ampRepository.GetRisks().ToList(); RiskRegisterCollection projectRiskCollection = new RiskRegisterCollection(_ampRepository.GetRiskRegister(projectId)); if (projectRiskCollection.HasRiskItems()) { List <RiskRegister> projectRisks = projectRiskCollection.AllRisks().ToList(); RiskItemVMCollectionBuilder riskItemVmCollectionBuilder = new RiskItemVMCollectionBuilder(projectRiskCollection.AllRisks().ToList(), riskCategories, riskLikelihoods, riskImpacts, riskRatings); RiskItemsVM riskItemsVm = new RiskItemsVM(); riskItemsVm.projectRisks = riskItemVmCollectionBuilder.BuildRiskItemVMList(); return(riskItemsVm); } else { return(null); } }