示例#1
0
        private static string GetJobUrl(JobAd jobAd)
        {
            var jobsUrl   = new ReadOnlyApplicationUrl("~/jobs");
            var jobAdPath = jobAd.GetJobRelativePath();
            var path      = jobsUrl.Path.AddUrlSegments(jobAdPath);

            return(Application.ApplicationPathStartChar + new ReadOnlyApplicationUrl(path).AppRelativePathAndQuery);
        }
示例#2
0
        private void View(JobAd jobAd, bool isCommunityJobAd, bool isCommunityMember, Member member)
        {
            var url = new ReadOnlyApplicationUrl(true, "~/jobs/" + jobAd.GetJobRelativePath());

            if (isCommunityJobAd)
            {
                // It is a community job ad, so must be a community member and logged in.

                if (isCommunityMember && member != null)
                {
                    Get(url);
                    AssertUrl(url);
                    AssertJobAd(jobAd);
                }
                else
                {
                    if (member == null)
                    {
                        // Needs to log in.

                        var loginUrl = LogInUrl.AsNonReadOnly();
                        loginUrl.QueryString.Add("returnUrl", url.Path);
                        Get(url);
                        AssertUrl(loginUrl);
                    }
                    else
                    {
                        Get(HttpStatusCode.NotFound, url);
                    }
                }
            }
            else
            {
                // If not a community job then can always be seen.

                Get(url);
                AssertUrl(url);
                AssertJobAd(jobAd);
            }
        }