private bool MeetCriteria(Fund fund, SearchCriteria searchCriteria) { foreach (var filter in searchCriteria.Filters.Where(f=>f.Value.Any())) { var propertyInfo = _fundPropertyInfos.Single(f=>f.Name == filter.Key); if (!filter.Value.Contains(propertyInfo.GetValue(fund)?.ToString())) return false; } return true; }
public IList<Fund> GetFundsByCriteria(SearchCriteria searchCriteria) { return _funds.Where(f => MeetCriteria(f, searchCriteria)).ToList(); }