18 lines
491 B
C#
18 lines
491 B
C#
using System.Reflection;
|
|
using System.Web.Mvc;
|
|
|
|
namespace MileageTraker.Web.Attributes
|
|
{
|
|
public class RequireRequestValueAttribute : ActionMethodSelectorAttribute
|
|
{
|
|
public RequireRequestValueAttribute(string valueName)
|
|
{
|
|
ValueName = valueName;
|
|
}
|
|
public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo)
|
|
{
|
|
return (controllerContext.HttpContext.Request[ValueName] != null);
|
|
}
|
|
public string ValueName { get; private set; }
|
|
}
|
|
} |