예제 #1
0
        private void CreateOrganisationCookieData(OrchestratorResponse <OrganisationDetailsViewModel> response)
        {
            EmployerAccountData data;

            if (response.Data?.Name != null)
            {
                data = new EmployerAccountData
                {
                    OrganisationType              = response.Data.Type,
                    OrganisationReferenceNumber   = response.Data.ReferenceNumber,
                    OrganisationName              = response.Data.Name,
                    OrganisationDateOfInception   = response.Data.DateOfInception,
                    OrganisationRegisteredAddress = response.Data.Address,
                    OrganisationStatus            = response.Data.Status ?? string.Empty,
                    PublicSectorDataSource        = response.Data.PublicSectorDataSource,
                    Sector = response.Data.Sector
                };
            }
            else
            {
                var existingData = _orchestrator.GetCookieData(HttpContext);

                data = new EmployerAccountData
                {
                    OrganisationType              = existingData.OrganisationType,
                    OrganisationReferenceNumber   = existingData.OrganisationReferenceNumber,
                    OrganisationName              = existingData.OrganisationName,
                    OrganisationDateOfInception   = existingData.OrganisationDateOfInception,
                    OrganisationRegisteredAddress = existingData.OrganisationRegisteredAddress,
                    OrganisationStatus            = existingData.OrganisationStatus,
                    PublicSectorDataSource        = existingData.PublicSectorDataSource,
                    Sector = existingData.Sector
                };
            }

            _orchestrator.CreateCookieData(HttpContext, data);
        }