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);
}
}
}