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)); }
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); } }
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))); }