1

In my api reponse i need to return BadRequest Response with Object which is given by user. I am using IHttpActionResult as return type. can any one try to help me.

I have tried

public IHttpActionResult Test()
{ 
   var Response = Method1();
   return BadRequest(Response);
}

But BadRequest doesn't accept the parameter.

Peter B
  • 22,460
  • 5
  • 32
  • 69
Satheesh
  • 83
  • 2
  • 3
  • 13

1 Answers1

3

Here is one way:

Response.StatusCode = 400;
return Content("Something here");
tymtam
  • 31,798
  • 8
  • 86
  • 126