private void PopulateReportAndSubmitViewModel(ReportReviewAndSubmitViewModel viewModel, long organisationId, int reportingYear) { Organisation organisation = dataRepository.Get <Organisation>(organisationId); viewModel.Organisation = organisation; viewModel.ReportingYear = reportingYear; Return submittedReturn = organisation.GetReturn(reportingYear); bool isEditingSubmittedReturn = submittedReturn != null; viewModel.IsEditingSubmittedReturn = isEditingSubmittedReturn; viewModel.DraftReturn = draftReturnService.GetDraftReturn(organisationId, reportingYear); viewModel.WillBeLateSubmission = draftReturnService.DraftReturnWouldBeNewlyLateIfSubmittedNow(viewModel.DraftReturn); }
public IActionResult ReportReview(string encryptedOrganisationId, int reportingYear) { ControllerHelper.Throw404IfFeatureDisabled(FeatureFlag.NewReportingJourney); long organisationId = ControllerHelper.DecryptOrganisationIdOrThrow404(encryptedOrganisationId); ControllerHelper.ThrowIfUserAccountRetiredOrEmailNotVerified(User, dataRepository); ControllerHelper.ThrowIfUserDoesNotHavePermissionsForGivenOrganisation(User, dataRepository, organisationId); ControllerHelper.ThrowIfReportingYearIsOutsideOfRange(reportingYear); if (!draftReturnService.DraftReturnExistsAndIsComplete(organisationId, reportingYear)) { return(RedirectToReportOverviewPageWithNotReadyStatusMessage(encryptedOrganisationId, reportingYear)); } var viewModel = new ReportReviewAndSubmitViewModel(); PopulateReportAndSubmitViewModel(viewModel, organisationId, reportingYear); return(View("ReportReview", viewModel)); }