Urgent: How to return the response like the below framework code in Dotnet core webapi

  • Thread starter Thread starter Jo Swa(K.P.Elayaraja)-MCP
  • Start date Start date
J

Jo Swa(K.P.Elayaraja)-MCP

Guest
Hi every one,

Blow is my code working fine in framework code and I need to do the same in dotnet core. I tried and unable to get any luck. Hope some one may knw this and pls reply as soon as possible.

public ActionResult getsample(String obj)
{
//...
//...
// etc..
if (headerValues == "application/json")
{
return Content(HttpStatusCode.OK, resultObject, new JsonMediaTypeFormatter { SerializerSettings = { NullValueHandling = NullValueHandling.Ignore } });
}
else
return Content(HttpStatusCode.OK, resultObject, Configuration.Formatters.XmlFormatter);
}


Thanks

JoSwa



If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful" Best Online Journal

Continue reading...
 
Back
Top