I work on web api project.
Here is action method:
public async Task<IHttpActionResult> GetDamageEvents(int siteObjectId, int statusId)
{
try
{
if (siteObjectId == null || siteObjectId == 0) return (what status?)
if (statusId == null || statusId == 0) return (what status?)
//some logic
return Ok(some result);
}
catch (Exception)
{
return BadRequest();
}
}
As you can see in method above I have two parameters siteObjectId and statusId,
if those parameters are null or zero I need to return to client appropriate status code.
What status code should it be?I think BadRequest status code it too general.