public IEnumerable<Product> FindProductsByFilter(MetaAttribute metaAttribute, string productAttributeRawValue1, IEnumerable<Product> products) { var templateBuyer = new Buyer(); var preference = new Preference(); preference.MetaAttribute = metaAttribute; preference.RawValues = productAttributeRawValue1; templateBuyer.Preferences.Add(preference); return products.Where(product => templateBuyer.IsMatch(product)); }
public MatchResult Match(Buyer buyer, IList<Product> products) { var previouslySent = productRepository.PreviouslySent(buyer.Id); var buyerMatches = new MatchResult(buyer, products.Where(product => buyer.IsMatch(product) && !previouslySent.Contains(product)).ToList()); return buyerMatches; }