title: Using async/await or task in web api controller (.net core)
body: <p>I have a .net core API which has a controller that builds an aggregated object to return.
  the object it creates is made of data that comes from 3 method calls to a service class. These are all independent of each other and can be run in isolation from each other.
  Currently I am using tasks to improve the performance of this controller. the current version looks something like this...</p>
  
  <pre><code>[HttpGet]
  public IActionResult myControllerAction()
  {      
      var data1 = new sometype1();
      var data2 = new sometype2();
      var data3 = new List&lt;sometype3&gt;();
  
      var t1 = new Task(() =&gt; { data1 = service.getdata1(); });
      t1.Start();
  
      var t2 = new Task(() =&gt; { data2 = service.getdata2(); });
      t2.Start();
  
      var t3 = new Task(() =&gt; { data3 = service.getdata2(); });
      t3.Start();
  
      Task.WaitAll(t1, t2, t3);
  
      var data = new returnObject
      {
           d1 = data1,
           d2 = data2,
           d2 = data3
      };
  
      return Ok(data);
  }
  </code></pre>
  
  <p>This works well however I am wondering  if using tasks is the best solution here? Would using async/await be a better idea and more accepted way?</p>
  
  <p>For example should the controller be marked as async and an await put on each call to the the service methods?</p>