title: How to write custom actionResult in asp.net core
body: <p>In webApi2 i could write a custom ActionResult by inheriting IHttpActionResult.</p>
  
  <p>Sample : </p>
  
  <pre><code>public class MenivaActionResult : IHttpActionResult
      {
          private readonly HttpRequestMessage _request;
          private readonly ServiceResponseBase _response;
  
          public MenivaActionResult(HttpRequestMessage request, ServiceResponseBase response)
          {
              _request = request;
              _response = response;
          }
  
  
          public Task&lt;HttpResponseMessage&gt; ExecuteAsync(CancellationToken token)
          {
  
              HttpResponseMessage httpresponseMessage = _response.Exception != null
                  ? _request.CreateErrorResponse((HttpStatusCode)_response.HttpCode,
                      _response.Exception.Message+":"+_response.Exception.HelpCode)
                  : _request.CreateResponse((HttpStatusCode)_response.HttpCode, _response.Data);
              return Task.FromResult(httpresponseMessage);
          }
      }
  </code></pre>
  
  <p>The ServiceResponseBase class object holds all the exception and data from service layer.. </p>
  
  <p>How i can port this code to asp.net core. I tried but i dont know how create a response message from <strong>HttpRequestMessage</strong>  object in .net core. The <strong>IActionResult</strong> only have <code>Task ExecuteResultAsync(ActionContext context)</code> method. how i can modify the response from this method</p>