title: Building a MultipartFormData API response
body: <p>I need to build an API that returns a JSON object and attached files in byte array form. So to do this I thought of using MultipartFormDataContent class in C#. I have the API written something like this.</p>
  <pre><code>public async Task&lt;IHttpActionResult&gt; MethodName(Params){
      ......statements......
      var responseContent = new MultipartFormDataContent();
      ......statements......
      responseContent.Add(new StringContent(jsonString), 'JSON Object');
      ......statements......
      responseContent.Add(byteArrayContent);
      return responseContent;
  }
  </code></pre>
  <p>This is giving an error while building the project about not being able to convert the responseContent to IHttpActionResult. So I tried explicit casting like so.</p>
  <pre><code>return (IHttpActionResult)responseContent;
  </code></pre>
  <p>But this throws a runtime error about not being able to convert to IHttpActionResult. So how would I go about returning responseContent. Any help is appreciated.</p>