Beispiel #1
0
        private Organisation CreateOrganisation(EmployerAccount account)
        {
            var organisation = new Organisation
            {
                Name        = account.OrganisationName,
                AffiliateId = GetEmployerAffiliateId(),
                Address     = new Address {
                    Location = _locationQuery.ResolveLocation(GetCurrentCountry(), account.Location)
                },
            };

            _organisationsCommand.CreateOrganisation(organisation);
            return(organisation);
        }
Beispiel #2
0
        private Employer Join(HttpContextBase context, EmployerAccount account, Action <Employer> createEmployer)
        {
            account.Prepare();
            account.Validate();

            // Create the organisation.

            var organisation = CreateOrganisation(account);

            // Create the employer.

            var employer = new Employer
            {
                FirstName    = account.FirstName,
                LastName     = account.LastName,
                EmailAddress = new EmailAddress {
                    Address = account.EmailAddress, IsVerified = true
                },
                PhoneNumber  = _phoneNumbersQuery.GetPhoneNumber(account.PhoneNumber, ActivityContext.Current.Location.Country),
                Organisation = organisation,
                SubRole      = account.SubRole,
                Industries   = _industriesQuery.GetIndustries(account.IndustryIds),
            };

            createEmployer(employer);

            // Log the user in.

            _authenticationManager.LogIn(context, employer, AuthenticationStatus.Authenticated);

            // Initialise.

            _referralsManager.CreateReferral(context.Request, employer.Id);
            InitialiseEmployerProfile(employer.Id);
            return(employer);
        }