title: How to create a Dependency Injection using Microsoft Asp.net WebApi
body: <p>I have a little experience working with Dependency Injection using Xamarin.Forms, but not in WebApi, What I want is send data through my Interface and execute inside of my Class which is implementing that Interface, there's what I have :</p>
  
  <pre><code>public interface IRepository
  {
      IHttpActionResult SendContext(user user);
      IHttpActionResult GetContextData(int id);
  }
  
  public class ContextGoneBase : ApiController,IRepository
  {
      public  IHttpActionResult GetContextData(int id)
      {
          try
          {
              using (var context = new GoneContext())
              {
                  var result = context.user.Where(a =&gt; a.id_user == id).Select(w =&gt;
                  new { w.user_name, w.cellphone_number, w.user_kind, w.CEP, w.area.area_name, w.district, w.city.city_name, w.city.state.state_name });
                  var list = result.ToList();
  
                  if (list != null)
                  {
                      return Ok(list);
                  }
                  else
                  {
                      return BadRequest();
                  }
              }
          }
          catch (Exception)
          {
              return BadRequest();
          }
      }
  </code></pre>
  
  <p>And Inside of my controller I was trying to do something like that:</p>
  
  <pre><code>[Route("86538505")]
      public IHttpActionResult GetData(int id, IRepository repo)
      {
          this._repo = repo;
          var result = _repo.GetContextData(id);
          return result;
      }
  </code></pre>
  
  <p>But, it fails! Thanks!</p>