Info
Version: | 1.0.4722.37515 |
Author(s): | Matthias Kainer |
Last Update: | Wednesday, December 5, 2012 |
.NET Fiddle: | Create the first Fiddle |
Project Url: | https://github.com/MatthiasKainer/DotNetRules |
NuGet Url: | https://www.nuget.org/packages/DotNetRules.Web.Mvc |
Install
Install-Package DotNetRules.Web.Mvc
dotnet add package DotNetRules.Web.Mvc
paket add DotNetRules.Web.Mvc
DotNetRules.Web.Mvc Download (Unzip the "nupkg" after downloading)
Dependencies
- DotNetRules(1.0.4722.37514)
Cleverly it’s called “DotNetRules.Web.Mvc”. It has the big advantage that it uses the ModelState to log errors.
To use it, simply call ApplyPolicy(For) at the ModelState, like so:
ModelState.ApplyPoliciesFor(orig, product,
policies: new[] { typeof(MapProductLegalPolicy) });
if (!ModelState.IsValid)
{
return Edit(product.Id);
}.