I Have a list data called LogData. Its code something like this.
var LogData = LogDataList.Select(data => new LogDataDto
{
RowCount = RowCount,
Location = data.LocationName,
Sender = data.FullName,
AccountName = data.AccName,
Messsage = data.Message
}).ToList();
Application gives me front-end value called searchText. I need to check that search text value is consists in any field in LogData
When searchText = "" I need to get all in the LogData and If searchText have some value, I need to check that value consist in any of this filels Location,Sender,AccountName and Messsage and nee to get those records.
So tried it as,
var result = LogData.Where(x => (searchText == "" || x.Location.Contains(searchText)) || x.Messsage.Contains(searchText));
Is that correct way to do this? How can I check search text value contains in other filed as well?