I have a simple search function that allows me to search for certain words from different tables. This is annoying as I feel there is a simple fix i'm not seeing here. Can someone assist? Thank you in advance.
ViewModel
IEnumerable<Owner> Owners {get; set;} IEnumerable<Car> Cars {get; set;}
Search Method
public IEnumerable<ViewModel> Search(string search) { ViewModel searchVM = new ViewModel();return searchVM.Owner.Where(o => o.Name.Contains(search)) ||
searchVM.Cars.Where(c => c.Model.Contains(search));
}
Error
Operator ‘||’ cannot be applied to operands of type ‘IEnumerable<Owner>’ and
‘IEnumerable<Car>’
#c-sharp #asp.net #linq