Search results
PDF

Why should not use Produces attribute in web API controller

Produces attribute forces all actions within the controller to return JSON-formatted responses. ReportHelper itself will provide the processing data with JSON string. So, there is no need to use produces attribute in Web API controller and actions for converting the JSON also should not be changed for other types.

   public object PostReportAction(Dictionary<string, object> jsonResult)
    {
        return ReportHelper.ProcessReport(jsonResult, this);
    }