You can use this class to personalize the results of your APIs and display the results with a fixed format.
Package required for use:
"Microsoft.AspNetCore.Mvc.Core" Version="2.2.5"
Add using:
using static ApiResponse;
Success()
return Success();
return Success("Custom Message");
return Success(data: new { }); // Return Data
return Success("Custom Message", new { });
NotFound()
return NotFound();
return NotFound("Custom Message");
Filed()
return Filed("Custom Message");
return Filed("Custom Message", 000); // Defult is 400
ServerError()
return ServerError();
return ServerError("Custom Message");
{
"statusCode" : 000 ( http status code ),
"isSuccess" : true/false,
"message" : "string",
"data" : null ( response data )
}