Exemple #1
0
        private JobAdQuestionsModel GetJobAdQuestionsModel(Guid jobAdId, Guid applicationId)
        {
            var member = CurrentMember;
            var jobAd  = _memberJobAdViewsQuery.GetJobAdView(jobAdId);

            if (jobAd == null)
            {
                return(null);
            }

            var application = _memberApplicationsQuery.GetInternalApplication(applicationId);

            if (application == null)
            {
                return(null);
            }

            // Get the user who is doing the applying.

            AnonymousContact anonymousContact = null;

            if (member == null)
            {
                if (CurrentAnonymousUser != null)
                {
                    anonymousContact = GetAnonymousContact(applicationId);
                    if (anonymousContact == null)
                    {
                        return(null);
                    }
                }
            }
            else
            {
                if (member.Id != application.ApplicantId)
                {
                    return(null);
                }
            }

            if (member == null && anonymousContact == null)
            {
                return(null);
            }

            return(new JobAdQuestionsModel
            {
                JobAd = jobAd,
                Application = application,
                Member = member,
                AnonymousContact = anonymousContact,
            });
        }
        private IJobAd GetJobAd(Guid jobAdId, params JobAdProcessing[] validProcessings)
        {
            var jobAd = _memberJobAdViewsQuery.GetJobAdView(jobAdId);

            if (jobAd == null)
            {
                return(null);
            }

            // Also make sure it is the right sort of ad.

            return(validProcessings.Contains(jobAd.Processing)
                ? jobAd
                : null);
        }