How to rewrite BadRequest and Ok in .net web api?

mc 5,431 Reputation points
2023-05-23T10:20:33.7233333+00:00

How to rewrite

Ok

and BadRequest I can custom the return object?

if I return Ok(myObj) I want to add some property to myObj and If I return BadRequest I want to change the statusCode

Developer technologies | ASP.NET | ASP.NET Core
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.