SHOW:
|
|
- or go back to the newest paste.
1 | namespace WebApi.Infrastructure.Validation | |
2 | ||
3 | open System.Net | |
4 | open System.Net.Http | |
5 | open System.Web.Http.Filters | |
6 | ||
7 | type ModelValidationFilterAttribute () = | |
8 | inherit ActionFilterAttribute () | |
9 | ||
10 | override this.OnActionExecuting actionContext = | |
11 | DeltaOfTEntityTypeValidationProvider.searchAndValidateDelta actionContext | |
12 | if not actionContext.ModelState.IsValid then | |
13 | actionContext.Response <- | |
14 | actionContext.Request.CreateErrorResponse | |
15 | (HttpStatusCode.BadRequest, actionContext.ModelState) |