11. June 2015 06:41 by admin in
Let's say you have an Entity Framework query that returns a list of type User. And let's say your search query has multiple potential search filters that you want to apply.
Here's an example of where the "fullLoginName" field could be a full name that you can split on, such as "Clyde Thomes", or it could be a single items such as "Administrator":
if (isFilteredByLastName){ targetUsers = targetUsers.Where(x=>x.fullLoginName.Contains(" ")?x.fullLoginName.Split(' ')[1]==lastName:x.fullLoginName.Contains(lastName)).ToList();}
You can then use the targetUsers result as the subject of the next filter item.