This is how to construct dynamic query in LINQ.

 Dynamic LINQ