Created
October 13, 2016 18:20
-
-
Save BenjaminAdams/b05f75068f7df9b3cf7cef8909d20c50 to your computer and use it in GitHub Desktop.
Revisions
-
BenjaminAdams created this gist
Oct 13, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ using System; using System.Web.Http.Controllers; using System.Web.Http.Filters; namespace Payments.Productization.Process.FilterAttributes { [AttributeUsage(AttributeTargets.Class)] public class CheckModelForNullAttribute : ActionFilterAttribute { public override void OnActionExecuting(HttpActionContext context) { if (context == null) throw new ArgumentNullException("Input Payload was malformed, invalid, or empty"); foreach (var arg in context.ActionArguments) { if (arg.Value == null) { throw new ArgumentException("Input Payload was malformed, invalid, or empty", arg.Key); } } base.OnActionExecuting(context); } } }