title: How to avoid if else statements in filter API in Linq
body: <p>I have just started developing REST APIs in Net Core. I have to create an API for filter. 
  For Example,</p>
  
  <p>There are three tables, tbl_agent ,tbl_tags and tbl_agent_tags_mapping</p>
  
  <p>Agent table has following Columns
  id,
  name,
  company_name</p>
  
  <p>Tags table has following Columns 
  id, 
  tag_name</p>
  
  <p>tbl_agent_tags_mapping has following Columns 
  id,
  agent_id (FK),
  tag_id (FK)</p>
  
  <ul>
  <li>Multiple tags can be assigned to agent</li>
  </ul>
  
  <p>To filter Agent according to tag and name I am using below code which id not feasible.</p>
  
  <pre><code>IQueryable&lt;tbl_agent&gt; query = context.tbl_agent;
  
  if (name != String.Empty)
  {
      query = query.Where(x =&gt; x.name == name);
  }
  
  if (tags.Count &gt; 0)
  {
      var agent_ids = context.tbl_agent_tags_mapping
              .Where(x =&gt; tags.Contains(x.id))
              .Select(x =&gt; x.id).ToList();
  
      query = query.Where(x =&gt; agent_ids.Contains(x.job_order_id));
  }
  
  List&lt;tbl_agent&gt; agent_list = query.ToList();
  </code></pre>
  
  <p>In this example, I have taken only two parameters but actually I have 10 to 12 params in POST request of Filter API. </p>
  
  <p>Is there any design pattern to overcome this repetitive If..Else.. Statement?</p>