public ActionResult ShowBorrowerPopup(String loanId) { Guid loanIdValue; Guid.TryParse(loanId, out loanIdValue); if (loanIdValue == Guid.Empty) { return(null); } var userAccountId = IdentityManager.GetUserAccountId(); var loanType = LoanServiceFacade.RetrieveLoanType(loanIdValue, userAccountId); var loanHomebuyingType = LoanServiceFacade.RetrieveLoanHomeBuyingType(loanIdValue, userAccountId); PreApprovalStatus preApprovalStatus = LoanServiceFacade.RetrievePreApprovalStatus(loanIdValue); var activities = ActivitiesServiceFacade.RetrieveActivities(loanIdValue, IdentityManager.GetUserAccountId()); var activityCLA = activities == null ? null : activities.FirstOrDefault(c => c.ActivityType == ActivityType.CompleteLoanApplication); var activityPAR = activities == null ? null : activities.FirstOrDefault(c => c.ActivityType == ActivityType.PreApprovalRequest); bool IsPreApprovalQueue = !preApprovalStatus.Equals(PreApprovalStatus.Completed) && loanType.Equals(LoanTransactionType.Purchase) && loanHomebuyingType.Equals(HomeBuyingType.GetPreApproved) && activityPAR != null && (activityPAR.Status == ActivityStatus.Submitted || activityPAR.Status == ActivityStatus.Completed || activityPAR.Status == ActivityStatus.Update); if (((IsPreApprovalQueue && activityPAR.Status != ActivityStatus.Submitted && activityPAR.Status != ActivityStatus.Completed))) { return(PartialView("_borrowersInformationPopupMessage")); } if (!IsPreApprovalQueue && (activityCLA == null || (activityCLA.Status != ActivityStatus.Submitted && activityCLA.Status != ActivityStatus.Completed))) { return(PartialView("_borrowersInformationPopupMessage")); } Property property = PropertyServiceFacade.RetrieveSubjectProperty(loanIdValue, userAccountId); var borrowerModel = BorrowerServiceFacade.GetBorrowersInformation(loanIdValue); if (borrowerModel == null) { return(null); } if (property != null) { borrowerModel.OccupancyType = property.OccupancyType; } SetupLookups(borrowerModel); if (borrowerModel.Borrower != null && borrowerModel.CoBorrower != null) { borrowerModel.BorrowerAndCoBorrowerAddressAreSame = AddressHelper.BorrowerAndCoborrowerAddressesAreSame(borrowerModel.Borrower.Addresses.ToList(), borrowerModel.CoBorrower.Addresses.ToList()); } if (borrowerModel.CoBorrower == null) { borrowerModel.CoBorrower = new Contracts.Borrower(); } if (borrowerModel.CoBorrowerModelInfo == null) { borrowerModel.CoBorrowerModelInfo = new BorrowerModelInfo(); } if (borrowerModel.CoBorrowerModelInfo.PresentAddress == null) { borrowerModel.CoBorrowerModelInfo.PresentAddress = new Address(); } if (borrowerModel.CoBorrowerModelInfo.MailingAddress == null) { borrowerModel.CoBorrowerModelInfo.MailingAddress = new Address(); } if (borrowerModel.CoBorrowerModelInfo.MailingAddress.IsSameAsPropertyAddress == null) { borrowerModel.CoBorrowerModelInfo.MailingAddress.IsSameAsPropertyAddress = false; } if (borrowerModel.Borrower != null) { borrowerModel.Borrower.Addresses = new Collection <Address>(); } if (borrowerModel.CoBorrower != null) { borrowerModel.CoBorrower.Addresses = new Collection <Address>(); } TitleInNameAndMannerTitleHeld titleInNameAndMannerTitleHeld = LoanServiceFacade.RetrieveTitleInNameAndMannerTitleHeld(loanIdValue, -1); borrowerModel.TitleAndManner = titleInNameAndMannerTitleHeld; borrowerModel.MannerTitleHeld.Insert(0, new Lookup { Name = "Select One", Value = -1 }); return(PartialView("_borrowersInformation", borrowerModel)); }