} // repo() private Guid? organisationId() { var poRepo = new ProjectOrganisationRepository(); var projectOrg = poRepo.GetByStaffMember(User.Identity.Name); if (projectOrg != null) return projectOrg.Id; return null; // Admin } // organisationId
} // createReferralReport private ReferralReport createReferralReport(Client client) { var poRepo = new ProjectOrganisationRepository(); var projectOrg = poRepo.GetByStaffMember(User.Identity.Name); var report = new ReferralReport(staffName(User.Identity.Name)); var ra = client.CurrentRiskAssessment; var who = poRepo.FetchReferralAgencies(projectOrg.Id); foreach (var theme in ra.ThemeAssessments) { foreach (var category in theme.Categories) { foreach (var risk in category.Risks) { if (risk.Status == "notAtRisk") { continue; } foreach (var agency in who) { foreach (var riskId in agency.AssociatedRiskIds) { if (riskId == risk.Id) { report.add(risk.Id, agency); } } } } } } return(report); } // createReferralReport