public async Task <ActionResult> TransferDetailsForReceiver(string hashedAccountId, string hashedTransferRequestId) { if (!await IsUserRoleAuthorized(hashedAccountId, Role.Owner, Role.Transactor)) { return(View("AccessDenied")); } var model = await Orchestrator.GetTransferRequestDetails(hashedAccountId, CallerType.TransferReceiver, hashedTransferRequestId, OwinWrapper.GetClaimValue(@"sub")); return(View(model)); }
private async Task <bool> IsUserRoleAuthorized(string hashedAccountId, params Role[] roles) { return(await _orchestrator .AuthorizeRole(hashedAccountId, OwinWrapper.GetClaimValue(@"sub"), roles)); }
public async Task <ActionResult> ViewAccounts() { var accounts = await _homeOrchestrator.GetUserAccounts(OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName)); return(View(ControllerConstants.IndexActionName, accounts)); }
public async Task <ActionResult> ConfirmChanges(ApprenticeshipViewModel apprenticeship) { if (!await IsUserRoleAuthorized(apprenticeship.HashedAccountId, Role.Owner, Role.Transactor)) { return(View("AccessDenied")); } if (!ModelState.IsValid) { apprenticeship.AddErrorsFromModelState(ModelState); } var model = await _orchestrator.GetConfirmChangesModel( apprenticeship.HashedAccountId, apprenticeship.HashedApprenticeshipId, OwinWrapper.GetClaimValue(@"sub"), apprenticeship); var validatorResult = await _orchestrator.ValidateApprenticeship(apprenticeship, model.Data); if (validatorResult.Any()) { apprenticeship.AddErrorsFromDictionary(validatorResult); } if (apprenticeship.ErrorDictionary.Any()) { var viewModel = await _orchestrator.GetApprenticeshipForEdit(apprenticeship.HashedAccountId, apprenticeship.HashedApprenticeshipId, OwinWrapper.GetClaimValue(@"sub")); viewModel.Data.Apprenticeship = apprenticeship; SetErrorMessage(viewModel, viewModel.Data.Apprenticeship.ErrorDictionary); return(View("Edit", viewModel)); } if (!AnyChanges(model.Data)) { var viewModel = await _orchestrator.GetApprenticeshipForEdit(apprenticeship.HashedAccountId, apprenticeship.HashedApprenticeshipId, OwinWrapper.GetClaimValue(@"sub")); viewModel.Data.Apprenticeship = apprenticeship; viewModel.Data.Apprenticeship.ErrorDictionary.Add("NoChangesRequested", "No changes made"); SetErrorMessage(viewModel, viewModel.Data.Apprenticeship.ErrorDictionary); return(View("Edit", viewModel)); } _orchestrator.CreateApprenticeshipViewModelCookie(model.Data); return(RedirectToAction("ConfirmChanges")); }
public async Task <ActionResult> ReviewChanges(string hashedAccountId, string hashedApprenticeshipId) { var viewModel = await _orchestrator .GetViewChangesViewModel(hashedAccountId, hashedApprenticeshipId, OwinWrapper.GetClaimValue(@"sub")); viewModel.Data.ApprenticeDetailsV2Link = _linkGenerator.CommitmentsV2Link($"{hashedAccountId}/apprentices/{hashedApprenticeshipId}/details"); return(View(viewModel)); }
public async Task <ActionResult> HasApprenticeBeenMadeRedundant(string hashedAccountId, string hashedApprenticeshipId, [CustomizeValidator(RuleSet = "default,Date,Redundant")] ChangeStatusViewModel model) { if (!await IsUserRoleAuthorized(hashedAccountId, Role.Owner, Role.Transactor)) { return(View("AccessDenied")); } if (!ModelState.IsValid) { var viewResponse = await _orchestrator.GetRedundantViewModel(hashedAccountId, hashedApprenticeshipId, model.ChangeType.Value, model.DateOfChange.DateTime, model.WhenToMakeChange, OwinWrapper.GetClaimValue(@"sub"), model.MadeRedundant); return(View(new OrchestratorResponse <RedundantApprenticeViewModel> { Data = viewResponse.Data })); } return(RedirectToRoute("StatusChangeConfirmation", new { changeType = model.ChangeType, whenToMakeChange = model.WhenToMakeChange, dateOfChange = model.DateOfChange.DateTime, madeRedundant = model.MadeRedundant })); }
public async Task <ActionResult> StatusChangeConfirmation(string hashedAccountId, string hashedApprenticeshipId, [CustomizeValidator(RuleSet = "default,Date,Confirm")] ChangeStatusViewModel model) { if (!await IsUserRoleAuthorized(hashedAccountId, Role.Owner, Role.Transactor)) { return(View("AccessDenied")); } if (!ModelState.IsValid) { var response = await _orchestrator.GetChangeStatusConfirmationViewModel(hashedAccountId, hashedApprenticeshipId, model.ChangeType.Value, model.WhenToMakeChange, model.DateOfChange.DateTime, model.MadeRedundant, OwinWrapper.GetClaimValue(@"sub")); return(View(response)); } if (model.ChangeConfirmed.HasValue && !model.ChangeConfirmed.Value) { return(Redirect(_linkGenerator.CommitmentsV2Link($"{hashedAccountId}/apprentices/{hashedApprenticeshipId}/details"))); } await _orchestrator.UpdateStatus(hashedAccountId, hashedApprenticeshipId, model, OwinWrapper.GetClaimValue(@"sub"), OwinWrapper.GetClaimValue(DasClaimTypes.DisplayName), OwinWrapper.GetClaimValue(DasClaimTypes.Email)); var flashmessage = new FlashMessageViewModel { Message = GetStatusMessage(model.ChangeType), Severity = FlashMessageSeverityLevel.Okay }; AddFlashMessageToCookie(flashmessage); return(Redirect(_linkGenerator.CommitmentsV2Link($"{hashedAccountId}/apprentices/{hashedApprenticeshipId}/details"))); }
public async Task <ActionResult> ViewChanges(string hashedAccountId, string hashedApprenticeshipId, UpdateApprenticeshipViewModel apprenticeship) { if (!ModelState.IsValid) { var viewmodel = await _orchestrator .GetViewChangesViewModel(hashedAccountId, hashedApprenticeshipId, OwinWrapper.GetClaimValue(@"sub")); viewmodel.Data.AddErrorsFromModelState(ModelState); SetErrorMessage(viewmodel, viewmodel.Data.ErrorDictionary); return(View(viewmodel)); } if (apprenticeship.ChangesConfirmed != null && apprenticeship.ChangesConfirmed.Value) { await _orchestrator.SubmitUndoApprenticeshipUpdate(hashedAccountId, hashedApprenticeshipId, OwinWrapper.GetClaimValue(@"sub"), OwinWrapper.GetClaimValue(DasClaimTypes.DisplayName), OwinWrapper.GetClaimValue(DasClaimTypes.Email)); SetOkayMessage("Changes undone"); } return(RedirectToAction("Details")); }
public async Task <ActionResult> ReviewChanges(string hashedAccountId, string hashedApprenticeshipId) { var viewModel = await _orchestrator .GetViewChangesViewModel(hashedAccountId, hashedApprenticeshipId, OwinWrapper.GetClaimValue(@"sub")); return(View(viewModel)); }
private string GetUserId() { var userIdClaim = OwinWrapper.GetClaimValue(@"sub"); return(userIdClaim ?? ""); }
private string GetUserId() { var userIdClaim = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName); return(userIdClaim ?? ""); }
public async Task <ActionResult> ConfirmRequestChanges(DataLockStatusViewModel model) { if (!ModelState.IsValid) { model.AddErrorsFromModelState(ModelState); var viewModel = await _orchestrator.GetDataLockChangeStatus(model.HashedAccountId, model.HashedApprenticeshipId, OwinWrapper.GetClaimValue(@"sub")); viewModel.Data.ErrorDictionary = model.ErrorDictionary; return(View("RequestChanges", viewModel)); } await _orchestrator.ConfirmRequestChanges(model.HashedAccountId, model.HashedApprenticeshipId, OwinWrapper.GetClaimValue("sub"), model.ChangesConfirmed ?? false); return(RedirectToAction("Details", "EmployerManageApprentices", new { model.HashedAccountId, model.HashedApprenticeshipId })); }
public async Task <ActionResult> RequestChanges(string hashedAccountId, string hashedApprenticeshipId) { var model = await _orchestrator.GetDataLockChangeStatus(hashedAccountId, hashedApprenticeshipId, OwinWrapper.GetClaimValue(@"sub")); return(View(model)); }
public async Task <ActionResult> TransferApproval(string hashedAccountId, string hashedTransferRequestId, TransferApprovalConfirmationViewModel viewModel) { if (!ModelState.IsValid) { var model = await Orchestrator.GetTransferRequestDetails(hashedAccountId, CallerType.TransferSender, hashedTransferRequestId, OwinWrapper.GetClaimValue(@"sub")); return(View("TransferDetails", model)); } await Orchestrator.SetTransferRequestApprovalStatus(hashedAccountId, viewModel.HashedCohortReference, hashedTransferRequestId, viewModel, OwinWrapper.GetClaimValue(@"sub"), OwinWrapper.GetClaimValue(DasClaimTypes.DisplayName), OwinWrapper.GetClaimValue(DasClaimTypes.Email)); var status = (bool)viewModel.ApprovalConfirmed ? "approved" : "rejected"; return(View("TransferConfirmation", new TransferConfirmationViewModel { TransferApprovalStatus = status, TransferReceiverName = viewModel.TransferReceiverName })); }
public async Task <ActionResult> WhenToApplyChange(string hashedAccountId, string hashedApprenticeshipId, ChangeStatusType changeType) { if (!await IsUserRoleAuthorized(hashedAccountId, Role.Owner, Role.Transactor)) { return(View("AccessDenied")); } var response = await _orchestrator.GetChangeStatusDateOfChangeViewModel(hashedAccountId, hashedApprenticeshipId, changeType, OwinWrapper.GetClaimValue(@"sub")); if (response.Data.SkipToMadeRedundantQuestion) { return(RedirectToRoute("MadeRedundant", new { changeType = response.Data.ChangeStatusViewModel.ChangeType.ToString().ToLower(), whenToMakeChange = WhenToMakeChangeOptions.Immediately, dateOfChange = default(DateTime?) })); } if (response.Data.SkipToConfirmationPage) { return(RedirectToRoute("StatusChangeConfirmation", new { changeType = response.Data.ChangeStatusViewModel.ChangeType.ToString().ToLower(), whenToMakeChange = WhenToMakeChangeOptions.Immediately, dateOfChange = default(DateTime?) })); } return(View(new OrchestratorResponse <WhenToMakeChangeViewModel> { Data = response.Data })); }
public async Task <ActionResult> RequestRestart(string hashedAccountId, string hashedApprenticeshipId) { var model = await _orchestrator.GetDataLockStatus(hashedAccountId, hashedApprenticeshipId, OwinWrapper.GetClaimValue(@"sub")); if (model.Data.TriageStatus != TriageStatus.Restart) { throw new InvalidStateException($"Apprenticeship data lock not is correct state, Current: {model.Data.TriageStatus}"); } return(View(model)); }
public async Task <ActionResult> WhenToApplyChange(string hashedAccountId, string hashedApprenticeshipId, [CustomizeValidator(RuleSet = "default,Date")] ChangeStatusViewModel model) { if (!await IsUserRoleAuthorized(hashedAccountId, Role.Owner, Role.Transactor)) { return(View("AccessDenied")); } if (!ModelState.IsValid) { var viewResponse = await _orchestrator.GetChangeStatusDateOfChangeViewModel(hashedAccountId, hashedApprenticeshipId, model.ChangeType.Value, OwinWrapper.GetClaimValue(@"sub")); return(View(new OrchestratorResponse <WhenToMakeChangeViewModel>() { Data = viewResponse.Data })); } var response = await _orchestrator.ValidateWhenToApplyChange(hashedAccountId, hashedApprenticeshipId, model); if (!response.ValidationResult.IsValid()) { response.ValidationResult.AddToModelState(ModelState); var viewResponse = await _orchestrator.GetChangeStatusDateOfChangeViewModel(hashedAccountId, hashedApprenticeshipId, model.ChangeType.Value, OwinWrapper.GetClaimValue(@"sub")); return(View(new OrchestratorResponse <WhenToMakeChangeViewModel>() { Data = viewResponse.Data })); } return(RedirectToRoute("MadeRedundant", new { whenToMakeChange = model.WhenToMakeChange, dateOfChange = response.DateOfChange })); }
public async Task <ActionResult> ChangeStatus(string hashedAccountId, string hashedApprenticeshipId) { if (!await IsUserRoleAuthorized(hashedAccountId, Role.Owner, Role.Transactor)) { return(View("AccessDenied")); } var response = await _orchestrator.GetChangeStatusChoiceNavigation(hashedAccountId, hashedApprenticeshipId, OwinWrapper.GetClaimValue(@"sub")); return(View(response)); }
public async Task <ActionResult> StatusChangeConfirmation(string hashedAccountId, string hashedApprenticeshipId, ChangeStatusType changeType, WhenToMakeChangeOptions whenToMakeChange, DateTime?dateOfChange, bool?madeRedundant) { if (!await IsUserRoleAuthorized(hashedAccountId, Role.Owner, Role.Transactor)) { return(View("AccessDenied")); } var response = await _orchestrator.GetChangeStatusConfirmationViewModel(hashedAccountId, hashedApprenticeshipId, changeType, whenToMakeChange, dateOfChange, madeRedundant, OwinWrapper.GetClaimValue(@"sub")); return(View(response)); }
public async Task <ActionResult> ConfirmPayeScheme(string hashedAccountId) { var gatewayResponseModel = await _employerAccountPayeOrchestrator.GetPayeConfirmModel( hashedAccountId, Request.Params[ControllerConstants.CodeKeyName], Url.Action(ControllerConstants.ConfirmPayeSchemeActionName, ControllerConstants.EmployerAccountPayeControllerName, new { hashedAccountId }, Request.Url?.Scheme), System.Web.HttpContext.Current?.Request.QueryString); if (gatewayResponseModel.Status == HttpStatusCode.NotAcceptable) { gatewayResponseModel.Status = HttpStatusCode.OK; var model = await _employerAccountPayeOrchestrator.Get(hashedAccountId, OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName)); model.FlashMessage = gatewayResponseModel.FlashMessage; return(View(ControllerConstants.IndexActionName, model)); } return(View(gatewayResponseModel)); }
public async Task <ActionResult> Edit(string hashedAccountId, string hashedApprenticeshipId) { if (!await IsUserRoleAuthorized(hashedAccountId, Role.Owner, Role.Transactor)) { return(View("AccessDenied")); } var model = await _orchestrator.GetApprenticeshipForEdit(hashedAccountId, hashedApprenticeshipId, OwinWrapper.GetClaimValue(@"sub")); var flashMessage = GetFlashMessageViewModelFromCookie(); if (flashMessage?.ErrorMessages != null && flashMessage.ErrorMessages.Any()) { model.FlashMessage = flashMessage; model.Data.Apprenticeship.ErrorDictionary = flashMessage.ErrorMessages; } return(View(model)); }
public async Task <ActionResult> ConfirmPayeScheme(string hashedAccountId, AddNewPayeSchemeViewModel model) { var result = await _employerAccountPayeOrchestrator.AddPayeSchemeToAccount(model, OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName)); if (result.Status != HttpStatusCode.OK) { return(View(result)); } var payeSchemeName = string.IsNullOrEmpty(model.PayeName) ? "this PAYE scheme" : model.PayeName; var flashMessage = new FlashMessageViewModel { Severity = FlashMessageSeverityLevel.Success, Headline = $"{model.PayeScheme} has been added", HiddenFlashMessageInformation = "page-paye-scheme-added" }; AddFlashMessageToCookie(flashMessage); return(RedirectToAction(ControllerConstants.NextStepsActionName, ControllerConstants.EmployerAccountPayeControllerName, new { model.HashedAccountId })); }
public async Task <ActionResult> SubmitChanges(string hashedAccountId, string hashedApprenticeshipId, UpdateApprenticeshipViewModel apprenticeship) { if (!await IsUserRoleAuthorized(hashedAccountId, Role.Owner, Role.Transactor)) { return(View("AccessDenied")); } var orginalApp = await _orchestrator.GetApprenticeship(hashedAccountId, hashedApprenticeshipId, OwinWrapper.GetClaimValue(@"sub")); apprenticeship.OriginalApprenticeship = orginalApp.Data; if (!ModelState.IsValid) { var viewmodel = await _orchestrator.GetOrchestratorResponseUpdateApprenticeshipViewModelFromCookie(hashedAccountId, hashedApprenticeshipId); viewmodel.Data.AddErrorsFromModelState(ModelState); SetErrorMessage(viewmodel, viewmodel.Data.ErrorDictionary); return(View("ConfirmChanges", viewmodel)); } if (apprenticeship.ChangesConfirmed != null && !apprenticeship.ChangesConfirmed.Value) { return(RedirectToAction("Details", new { hashedAccountId, hashedApprenticeshipId })); } await _orchestrator.CreateApprenticeshipUpdate(apprenticeship, hashedAccountId, OwinWrapper.GetClaimValue(@"sub"), OwinWrapper.GetClaimValue(DasClaimTypes.DisplayName), OwinWrapper.GetClaimValue(DasClaimTypes.Email)); var message = NeedReapproval(apprenticeship) ? "Suggested changes sent to training provider for approval, where needed." : "Apprentice updated"; var flashmessage = new FlashMessageViewModel { Message = message, Severity = FlashMessageSeverityLevel.Okay }; AddFlashMessageToCookie(flashmessage); return(RedirectToAction("Details", new { hashedAccountId, hashedApprenticeshipId })); }
public async Task <ActionResult> Details(string hashedAccountId, string empRef) { empRef = empRef.FormatPayeFromUrl(); var response = await _employerAccountPayeOrchestrator.GetPayeDetails(empRef, hashedAccountId, OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName)); return(View(response)); }
public async Task <ActionResult> ReviewChanges(string hashedAccountId, string hashedApprenticeshipId, UpdateApprenticeshipViewModel viewModel) { if (!ModelState.IsValid) { var viewmodel = await _orchestrator .GetViewChangesViewModel(hashedAccountId, hashedApprenticeshipId, OwinWrapper.GetClaimValue(@"sub")); viewmodel.Data.AddErrorsFromModelState(ModelState); viewModel.ApprenticeDetailsV2Link = _linkGenerator.CommitmentsV2Link($"{hashedAccountId}/apprentices/{hashedApprenticeshipId}/details"); SetErrorMessage(viewmodel, viewmodel.Data.ErrorDictionary); return(View(viewmodel)); } if (viewModel.ChangesConfirmed != null) { await _orchestrator.SubmitReviewApprenticeshipUpdate(hashedAccountId, hashedApprenticeshipId, OwinWrapper.GetClaimValue(@"sub"), viewModel.ChangesConfirmed.Value, OwinWrapper.GetClaimValue(DasClaimTypes.DisplayName), OwinWrapper.GetClaimValue(DasClaimTypes.Email)); var message = viewModel.ChangesConfirmed.Value ? "Changes approved" : "Changes rejected"; SetOkayMessage(message); } return(RedirectToAction("Details", new { hashedAccountId, hashedApprenticeshipId })); }
public async Task <ActionResult> AddOrganisation(AddLegalEntityViewModel model) { if (!ModelState.IsValid) { var orgTypeErrorResponse = new OrchestratorResponse <AddLegalEntityViewModel> { Data = model }; orgTypeErrorResponse.Data.AddErrorsFromModelState(ModelState); orgTypeErrorResponse.Status = HttpStatusCode.BadRequest; orgTypeErrorResponse.FlashMessage = new FlashMessageViewModel { Severity = FlashMessageSeverityLevel.Error, ErrorMessages = orgTypeErrorResponse.Data.ErrorDictionary, Headline = "Errors to fix", Message = "Check the following details:" }; return(View(orgTypeErrorResponse)); } OrchestratorResponse <OrganisationDetailsViewModel> response; //TODO this can be removed once we determine which is slow in prod var stopwatch = new System.Diagnostics.Stopwatch(); try { stopwatch.Start(); switch (model.OrganisationType) { case OrganisationType.Charities: response = await FindCharity(model.CharityRegistrationNumber, model.HashedAccountId, OwinWrapper.GetClaimValue(@"sub")); break; case OrganisationType.CompaniesHouse: response = await FindCompany(model.CompaniesHouseNumber, model.HashedAccountId, OwinWrapper.GetClaimValue(@"sub")); break; case OrganisationType.PublicBodies: var searchResponse = await FindPublicSectorOrganisation(model.PublicBodyName, model.HashedAccountId, OwinWrapper.GetClaimValue(@"sub")); if (searchResponse.Status == HttpStatusCode.OK) { if (searchResponse.Data.Results.Data.Count != 1 || searchResponse.Data.Results.Data.All(x => x.AddedToAccount)) { return(View("ViewPublicSectorOrganisationSearchResults", searchResponse)); } response = new OrchestratorResponse <OrganisationDetailsViewModel> { Data = searchResponse.Data.Results.Data.FirstOrDefault(), Status = searchResponse.Status }; } else { response = new OrchestratorResponse <OrganisationDetailsViewModel> { Data = new OrganisationDetailsViewModel(), Status = searchResponse.Status }; response.Data.ErrorDictionary = searchResponse.Data.ErrorDictionary; } break; case OrganisationType.Other: response = new OrchestratorResponse <OrganisationDetailsViewModel> { Data = new OrganisationDetailsViewModel() }; return(View("AddOtherOrganisationDetails", response)); default: throw new NotImplementedException("Org Type Not Implemented"); } } finally { stopwatch.Stop(); _logger.Info($"Company Search for {model.OrganisationType} took {stopwatch.ElapsedMilliseconds /1000d}s"); } if (response.Status == HttpStatusCode.OK) { //Removes empty address entries (i.e. ' , , ') var address = (response.Data?.Address ?? string.Empty).Replace(",", string.Empty); if (string.IsNullOrWhiteSpace(address)) { var addressViewModel = _mapper.Map <FindOrganisationAddressViewModel>(response.Data); var addressResponse = new OrchestratorResponse <FindOrganisationAddressViewModel> { Data = addressViewModel }; return(View("FindAddress", addressResponse)); } CreateOrganisationCookieData(response); return(RedirectToAction("GatewayInform", "EmployerAccount", response.Data)); } var errorResponse = new OrchestratorResponse <AddLegalEntityViewModel> { Data = model, Status = HttpStatusCode.OK }; errorResponse.Data.ErrorDictionary = response.Data.ErrorDictionary; errorResponse.FlashMessage = new FlashMessageViewModel { Severity = FlashMessageSeverityLevel.Error, ErrorMessages = errorResponse.Data.ErrorDictionary, Headline = "Errors to fix", Message = "Check the following details:" }; return(View("AddOrganisation", errorResponse)); }
public async Task <ActionResult> EditStopDate(string hashedAccountId, string hashedApprenticeshipId) { if (!await IsUserRoleAuthorized(hashedAccountId, Role.Owner, Role.Transactor)) { return(View("AccessDenied")); } var response = await _orchestrator.GetEditApprenticeshipStopDateViewModel(hashedAccountId, hashedApprenticeshipId, OwinWrapper.GetClaimValue(@"sub")); return(View(response)); }
public async Task <ActionResult> ChangeStatus(string hashedAccountId, string hashedApprenticeshipId, ChangeStatusViewModel model) { if (!await IsUserRoleAuthorized(hashedAccountId, Role.Owner, Role.Transactor)) { return(View("AccessDenied")); } if (!ModelState.IsValid) { var response = await _orchestrator.GetChangeStatusChoiceNavigation(hashedAccountId, hashedApprenticeshipId, OwinWrapper.GetClaimValue(@"sub")); return(View(response)); } if (model.ChangeType == ChangeStatusType.None) { return(Redirect(_linkGenerator.CommitmentsV2Link($"{hashedAccountId}/apprentices/{hashedApprenticeshipId}/details"))); } return(RedirectToRoute("WhenToApplyChange", new { changeType = model.ChangeType.ToString().ToLower() })); }
public void SignOutCleanup() { OwinWrapper.SignOutUser(); }
public async Task <ActionResult> SearchForOrganisationResults(string hashedAccountId, string searchTerm, int pageNumber = 1, OrganisationType?organisationType = null) { OrchestratorResponse <SearchOrganisationResultsViewModel> model; if (string.IsNullOrEmpty(searchTerm)) { var viewModel = new SearchOrganisationResultsViewModel { Results = new PagedResponse <OrganisationDetailsViewModel>() }; model = CreateSearchTermValidationErrorModel(viewModel); } else { model = await _orchestrator.SearchOrganisation(searchTerm, pageNumber, organisationType, hashedAccountId, OwinWrapper.GetClaimValue(@"sub")); } model.Data.IsExistingAccount = !string.IsNullOrEmpty(hashedAccountId); return(View(ControllerConstants.SearchForOrganisationResultsViewName, model)); }