title: Lambda Expression to Web API
body: <p>I am trying to pass a Lambda Expression to a Web API 2 call and not sure how to make this work.</p>
  
  <p>Let me give you some background</p>
  
  <p>Setup a Web API 2 that utilizes Entity Framework to communicate to the Database.</p>
  
  <p>My applications ultimately call up to the Web API 2 to be able to communicate with the Database.  My company ultimately requires this to allow added security to the Data Access Layer.</p>
  
  <p>We have built a repository on the App Side that communicates with the Web API just fine. However one of the functions we want to add is a FIND function that incorporates a Lambda Expression. </p>
  
  <pre><code>public IEnumerable&lt;T&gt; FindAll(Func&lt;T, bool&gt; exp)
  {
      HttpClientHandler hndlr = new HttpClientHandler();
      hndlr.UseDefaultCredentials = true;
      HttpClient httpClient = new HttpClient(hndlr);
  
      httpClient.BaseAddress = new Uri(ADMS.Utilities.Settings.DALService);
      HttpResponseMessage response = httpClient.GetAsync(string.Format("api/{0}/{1}", typeof(T).Name, exp)).Result;
  
      if (response.IsSuccessStatusCode)
      {
         return response.Content.ReadAsAsync&lt;IEnumerable&lt;T&gt;&gt;().Result.ToList();
      }
      return null;
  }
  </code></pre>
  
  <p>Question I have is now on the Web API 2 side in the controller how do I get this to accept the Lambda Expression? What do I need to put in the controller to see this? Do I need to convert the Lambda Expression? </p>