Пример #1
0
        public async Task <ActionResult> SetLegalEntity(string hashedAccountId, SelectLegalEntityViewModel selectedLegalEntity)
        {
            if (!ModelState.IsValid)
            {
                var response = await _employerCommitmentsOrchestrator.GetLegalEntities(hashedAccountId, selectedLegalEntity.CohortRef, OwinWrapper.GetClaimValue(@"sub"));

                return(View("SelectLegalEntity", response));
            }

            var agreement = await _employerCommitmentsOrchestrator.GetLegalEntitySignedAgreementViewModel(hashedAccountId,
                                                                                                          selectedLegalEntity.LegalEntityCode, selectedLegalEntity.CohortRef);

            if (agreement.Data.HasSignedAgreement)
            {
                return(RedirectToAction("SearchProvider", selectedLegalEntity));
            }
            else
            {
                return(RedirectToAction("AgreementNotSigned", agreement.Data));
            }
        }