How to search in two combined fields. As necessary, the search should occur at the end of SQL.
So to speak, I have a customer table with a first and last name. I would like for users to be able to search on both of these columns with a single search box.
Currently my query looks like this:
var query = DbContext.Customers .Where(c => c.FirstName.Contains(search) || c.LastName.Contains(search));
but it should be something like
var query = DbContext.Customers .Where(c => c.FullName.Contains(search));
source share