public ActionResult Review(int id) { var project = _projectRepository.GetByDataManagementPlanId(id); if (project == null || project.DataManagementPlan == null) { return View("DmpNotFound"); } if (!this.CurrentUser.IsPrincipalInvestigatorFor(project)) { return View("NoProjectAccessRight"); } if (project.ProvisioningStatus == ProvisioningStatus.Provisioned) { return View("DmpProvisioned"); } var vm = new ConfirmDataManagementPlanViewModel { DataManagementPlanId = project.DataManagementPlan.Id, ProjectTitle = project.Title }; return View("Review", vm); }
public ActionResult Review(ConfirmDataManagementPlanViewModel model) { if (!ModelState.IsValid) { return View(model); } // Get project information var project = _projectRepository.GetByDataManagementPlanId(model.DataManagementPlanId); if (project == null || project.DataManagementPlan == null) { return View("DmpNotFound"); } if (project.SourceProjectType == SourceProjectType.DEPOSIT) { return View("IncorrectProjectType"); } if (!this.CurrentUser.IsPrincipalInvestigatorFor(project)) { return View("NoProjectAccessRight"); } if (project.ProvisioningStatus == ProvisioningStatus.Provisioned) { return View("DmpProvisioned"); } // TODO: You can use the URDMS.Integration solution to handle provisioning in a robust manner or just alter the database directly and implement // further actions from the web application. _bus.Send<SiteRequestCommand>(m => { m.ProjectId = project.Id; m.ProjectTitle = project.Title; m.ProjectDescription = project.Description; m.UserRoles = CreateUserRolesDictionary(project); ; }); if (!project.DataCollections.Any(dc => dc.IsFirstCollection)) { var dataCollection = project.CreateInitialDataCollection(); _dataCollectionRepository.Save(dataCollection); } return RedirectToAction("Submitted", new { id = project.DataManagementPlan.Id }); }