title: asp.net mvc 5 asynchronous action method
body: <p>I have the following action method with <code>async</code> and <code>await</code> keywords:</p>
  
  <pre><code>[HttpPost]
  public async Task&lt;ActionResult&gt; Save(ContactFormViewModel contactFormVM)
  {
       if (domain.SaveContactForm(contactFormVM) &gt; 0)// saves data in database
       {
           bool result = await SendMails(contactFormVM);//need to execute this method asynchronously but it executes synchronously
           return Json("success");
       }
           return Json("failure");
    }
  
      public async Task&lt;bool&gt; SendMails(ContactFormViewModel contactFormVM)
      {
              await Task.Delay(0);//how to use await keyword in this function?
              domain.SendContactFormUserMail(contactFormVM);
              domain.SendContactFormAdminMail(contactFormVM);
              return true;
      }
  </code></pre>
  
  <p>In the above code, once the database operation is finished I want to immediately return <code>Json()</code> result and then call the <code>SendMails()</code> method which should execute in the background. What changes should I make to the above code?</p>