public override void OnActionExecuting(HttpActionContext actionContext) { if (_validate(actionContext.ActionArguments)) { var result = new CreateResult( new Response( ResponseStatus.NotFound, ResponseMessagesConstans.RequestCannotBeNullMissingProperties)); actionContext.Response = result.ToHttpResponseMessage(); } }
public override void OnActionExecuting(HttpActionContext actionContext) { if (actionContext.ModelState.IsValid == false) { var result = new CreateResult( new Response( ResponseStatus.BadRequest, ResponseMessagesConstans.BadRequest, actionContext.ModelState .SelectMany(x => x.Value.Errors.Select(e => new Exception(e.ErrorMessage, e.Exception))) .ToList())); actionContext.Response = result.ToHttpResponseMessage(); } }