public FoundCompanies Search(string input) { var foundCompanies = new FoundCompanies(); if (input.IsNullOrEmpty()) { return(foundCompanies); } var parsedInput = parser.Parse(input); var companies = new List <Company>(); foreach (var keyword in parsedInput) { companies.AddRange(repo.FindBy(keyword)); } foundCompanies.Names = companies.Select(x => x.Name).ToList(); return(foundCompanies); }
public FoundCompanies Search(string input) { var foundCompanies = new FoundCompanies(); if (string.IsNullOrEmpty(input)) { return(foundCompanies); } var keywords = parser.Parse(input); foreach (string keyword in keywords) { var companies = repo.FindBy(keyword); companies.ForEach(c => foundCompanies.Add(c.Name)); } return(foundCompanies); }