ActionFilters.Filters.ValidateModelStateAttribute.OnActionExecuting C# (CSharp) Method

OnActionExecuting() public method

public OnActionExecuting ( System.Web.Http.Controllers.HttpActionContext actionContext ) : void
actionContext System.Web.Http.Controllers.HttpActionContext
return void
        public override void OnActionExecuting(
            HttpActionContext actionContext) {

            if (!actionContext.ModelState.IsValid) {

                actionContext.Response = 
                    actionContext.Request.CreateErrorResponse(
                        HttpStatusCode.BadRequest, 
                        actionContext.ModelState);
            }
        }
    }
ValidateModelStateAttribute