Consuming IHttpActionResult from MVC controller
<p>I am working on MVC5 where I have web Api controller which is returning data and code is as below</p>

<pre><code>[Route("m/api/Group")]
        [HttpGet]
        public IHttpActionResult ListOfGroups()
        {
            try
            {
                var listOfGroups = GroupExecutor.GetListOfGroups();
                return Ok(listOfGroups);
            }
            catch (Exception ex)
            {
                LogClass.Logger.Error(ex.Message, ex);
                return InternalServerError();
            }
        }
</code></pre>

<p>If I run this url in brower ,its returning data correctly in json format.</p>

<p>Now I want consume this API controller method within same project through MVC controller and code is as below</p>

<pre><code>[HttpPost]
        [ValidateAntiForgeryHeader]
        public ActionResult GetListOfGroups()
        {
            try
            {
                var listofGroups = new GroupController().ListOfGroups();
                return GetJsonContentResult(listofGroups);
            }
            catch (Exception ex)
            {
                LogClass.Logger.Error(ex.Message, ex);
                return new HttpStatusCodeResult(HttpStatusCode.InternalServerError, Utility.GetDescriptionFromEnumValue(Helper.TypeOfError.ErrorOccuredWhileProcessingRequest));
            }
        }
</code></pre>

<p>Now When I run this code goes to api method but when returned back to controller ,its giving error</p>

<pre><code>Error getting value from 'Content Negotiation' on 'System.Web.Http.Results.OkNegotiatedContentResult
</code></pre>

<p>How can I solve this issue ?</p>

<p>EDIT : </p>

<pre><code>public ContentResult GetJsonContentResult(object data)
        {
            var camelCaseFormatter = new JsonSerializerSettings();
            camelCaseFormatter.ContractResolver = new CamelCasePropertyNamesContractResolver();
            var jsonResult = new ContentResult
            {
                Content = JsonConvert.SerializeObject(data, camelCaseFormatter),
                ContentType = "application/json"
            };
            return jsonResult;
        }
</code></pre>