Running multiple tasks asynchronously and awaiting for their results c#
<p>In my service layer I wanted to fire multiple methods asynchronously  and await for their results. </p>

<p>I tried with one at a time and it is erroring out. </p>

<p>In my <strong>service class</strong> I called the method like </p>

<pre><code>var _validChapterCodesTask = gd.validateChapterCodeDetails(_input1);

await Task.WhenAll(_validChapterCodesTask);

var _chapterCodeResult = await  _validChapterCodesTask;
</code></pre>

<p>And in <strong>DAL class</strong> the method definition looks like </p>

<pre><code> public async Task&lt;IEnumerable&lt;ChapterCodeValidationOutput&gt;&gt; validateChapterCodeDetails(GroupMembershipValidationInput gmvi)
 {
     Repository rep = new Repository();
     if (!gmvi._chapterCodes.All(x =&gt; x.Equals("")))
     {
         var _validChapterCodes = await rep.ExecuteStoredProcedureAsync&lt;Entities.Upload.ChapterCodeValidationOutput&gt;(SQL.Upload.UploadValidation.getChapterCodeValidationSQL(gmvi._chapterCodes),null);
         return _validChapterCodes;
     }
     else
         return new List&lt;ChapterCodeValidationOutput&gt;();
 }
</code></pre>

<p><strong>Error message</strong></p>

<blockquote>
  <p>Error 208 The <code>await</code> operator can only be used within an <code>async</code> method. Consider marking this method with the <code>async</code> modifier and changing its return type to <code>Task&lt;ARC.Donor.Business.Upload.GroupMembershipValidationOutput&gt;</code>.   <code>C:\Users\m1034699\Desktop\Stuart_Upgrade_2.1_New Approach\Stuart_Export_Upload_v2.1\Stuart Web Service\ARC.Donor.Service\Upload\UploadValidationServices.cs    34  13  ARC.Donor.Service</code></p>
</blockquote>

<p>in lines</p>

<pre><code>await Task.WhenAll(_validChapterCodesTask);

var _chapterCodeResult = await  _validChapterCodesTask; 
</code></pre>

<p>What am I doing wrong ?</p>