private List<Car> GetSearchedCars(SearchCriteria searchCriteria) { if (searchCriteria != null && searchCriteria.IsWildCard) { return carsList.Where(c => c.GeneralNamesAndSearchTerms.ToLower().Contains(searchCriteria.searchTerm)).ToList(); } else { return carsList .Where(c => c.CarName.ToLower().Contains(searchCriteria.SearchedCar.CarName.ToLower()) && c.CarType != null ? c.CarType == searchCriteria.SearchedCar.CarType : true && c.CarClass != null ? c.CarClass == searchCriteria.SearchedCar.CarClass : true && c.CarFuelVariant != null ? c.CarFuelVariant == searchCriteria.SearchedCar.CarFuelVariant : true ).ToList(); } }
public List<Car> GetSpecificCarsList(SearchCriteria searchCriteria) { return this.GetSearchedCars(searchCriteria); }