I have a controller in my MVC 6 API project. There is a post method and what I want is to validate posted value and return some error back to a client if data are not valid.
[HttpPost]
public void Post([FromBody]PostedHistoricalEvent value)
{
if (!IsHistoricalEventValid(value))
{
//return error status code
}
}
Now I wonder why Post method in the default template does not have any returning type but void and how then one should return an error http status code with some message?