示例#1
0
        private IList <RegisteredUser> GetUsers(Campaign campaign)
        {
            // Check the query first.

            if (!string.IsNullOrEmpty(campaign.Query))
            {
                return(_campaignCriteriaCommand.Match(campaign.Category, campaign.Query));
            }

            var criteria = _campaignsQuery.GetCriteria(campaign.Id);

            return(_campaignCriteriaCommand.Match(campaign.Category, criteria));
        }
示例#2
0
        private void TestSearch(Criteria criteria, IEnumerable <Employer> expected)
        {
            var users = _campaignCriteriaCommand.Match(CampaignCategory.Employer, criteria);

            Assert.AreEqual(expected.Count(), users.Count);

            // Order by email address.

            expected = expected.OrderBy(e => e.EmailAddress.Address);
            for (var index = 0; index < users.Count; ++index)
            {
                Assert.AreEqual(expected.ElementAt(index).Id, users.ElementAt(index).Id);
            }
        }
示例#3
0
        public ActionResult Search(Guid id)
        {
            // Get the campaign and criteria.

            var campaign = _campaignsQuery.GetCampaign(id);

            if (campaign == null)
            {
                return(NotFound("campaign", "id", id));
            }

            var criteria = _campaignsQuery.GetCriteria(id);

            if (criteria == null)
            {
                return(NotFound("criteria", "id", id));
            }

            var results = _campaignCriteriaCommand.Match(campaign.Category, criteria);

            return(View(CreateCampaignCriteriaResults(campaign, criteria, results)));
        }