diff --git a/Build/NuGet/DataAnnotationsExtensions.MVC3/DataAnnotationsExtensions.nuspec b/Build/NuGet/DataAnnotationsExtensions.MVC3/DataAnnotationsExtensions.nuspec index f0a050d..3508e7e 100644 --- a/Build/NuGet/DataAnnotationsExtensions.MVC3/DataAnnotationsExtensions.nuspec +++ b/Build/NuGet/DataAnnotationsExtensions.MVC3/DataAnnotationsExtensions.nuspec @@ -2,22 +2,25 @@ DataAnnotationsExtensions.MVC3 - 0.6.0.0 + 0.6.0.2 Scott Kirkland Scott Kirkland https://github.com/srkirkland/DataAnnotationsExtensions/raw/master/LICENSE.txt http://dataannotationsextensions.org http://dataannotationsextensions.org/Images/CheckIcon.png false - Validation attributes that extend Data Annotations and provide integrated server and client side validation (using unobtrusive jquery validation). + Validation attributes that extend Data Annotations and provide integrated server and client side validation (using unobtrusive jquery validation). + + This is a branch from the main project where rschiefer added GreaterThan and GreaterThanOrEqualTo validators. ASP.NET Validation MVC MVC3 - - + - - + + + + - \ No newline at end of file + diff --git a/Build/NuGet/DataAnnotationsExtensions/DataAnnotationsExtensions.nuspec b/Build/NuGet/DataAnnotationsExtensions/DataAnnotationsExtensions.nuspec index a3460d8..ca6513a 100644 --- a/Build/NuGet/DataAnnotationsExtensions/DataAnnotationsExtensions.nuspec +++ b/Build/NuGet/DataAnnotationsExtensions/DataAnnotationsExtensions.nuspec @@ -2,7 +2,7 @@ DataAnnotationsExtensions - 0.6.0.0 + 0.6.0.2 Scott Kirkland Scott Kirkland https://github.com/srkirkland/DataAnnotationsExtensions/raw/master/LICENSE.txt @@ -10,10 +10,13 @@ http://dataannotationsextensions.org/Images/CheckIcon.png false Validation attributes that can be used in any .NET 4.0 project to supplement the existing Data Annotations attributes. - If you are using MVC3 and also want client validation, use the DataAnnotationsExtensions.MVC3 package. + If you are using MVC3 and also want client validation, use the DataAnnotationsExtensions.MVC3 package. + + This is a branch from the main project where rschiefer added GreaterThan & GreaterThanOrEqualTo validators. ASP.NET Validation - + + - \ No newline at end of file + diff --git a/Build/artifacts/DataAnnotationsExtensions.ClientValidation.dll b/Build/artifacts/DataAnnotationsExtensions.ClientValidation.dll index 7086eb0..2da57e3 100644 Binary files a/Build/artifacts/DataAnnotationsExtensions.ClientValidation.dll and b/Build/artifacts/DataAnnotationsExtensions.ClientValidation.dll differ diff --git a/Build/artifacts/DataAnnotationsExtensions.NuGet.dll b/Build/artifacts/DataAnnotationsExtensions.NuGet.dll index 667209c..069770d 100644 Binary files a/Build/artifacts/DataAnnotationsExtensions.NuGet.dll and b/Build/artifacts/DataAnnotationsExtensions.NuGet.dll differ diff --git a/Build/artifacts/DataAnnotationsExtensions.dll b/Build/artifacts/DataAnnotationsExtensions.dll index a0af28d..bd378da 100644 Binary files a/Build/artifacts/DataAnnotationsExtensions.dll and b/Build/artifacts/DataAnnotationsExtensions.dll differ diff --git a/DataAnnotationsExtensions.ClientValidation/Adapters/GreaterThanAttributeAdapter.cs b/DataAnnotationsExtensions.ClientValidation/Adapters/GreaterThanAttributeAdapter.cs new file mode 100644 index 0000000..aa84a3f --- /dev/null +++ b/DataAnnotationsExtensions.ClientValidation/Adapters/GreaterThanAttributeAdapter.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Web.Mvc; +using DataAnnotationsExtensions.ClientValidation.Resources; +using DataAnnotationsExtensions.ClientValidation.Rules; + +namespace DataAnnotationsExtensions.ClientValidation.Adapters +{ + public class GreaterThanAttributeAdapter : DataAnnotationsModelValidator + { + public GreaterThanAttributeAdapter(ModelMetadata metadata, ControllerContext context, GreaterThanAttribute attribute) + : base(metadata, context, attribute) + { + } + + public override IEnumerable GetClientValidationRules() + { + Attribute.OtherPropertyDisplayName = GetOtherPropertyDisplayName(); + + var otherProp = FormatPropertyForClientValidation(Attribute.OtherProperty); + //We'll just use the built-in System.Web.Mvc client validation rule + return new[] { new ModelClientValidationGreaterThanRule(ErrorMessage, otherProp) }; + } + + private string GetOtherPropertyDisplayName() + { + if (Metadata.ContainerType != null && !String.IsNullOrEmpty(Attribute.OtherProperty)) + { + var propertyMetaData = ModelMetadataProviders.Current.GetMetadataForProperty(() => Metadata.Model, + Metadata.ContainerType, + Attribute.OtherProperty); + + return propertyMetaData.GetDisplayName(); + } + + return Attribute.OtherProperty; + } + + public static string FormatPropertyForClientValidation(string property) + { + if (property == null) + { + throw new ArgumentException(ClientValidationResources.Common_NullOrEmpty, "property"); + } + return "*." + property; + } + } + public class GreaterThanOrEqualToAttributeAdapter : DataAnnotationsModelValidator + { + public GreaterThanOrEqualToAttributeAdapter(ModelMetadata metadata, ControllerContext context, GreaterThanOrEqualToAttribute attribute) + : base(metadata, context, attribute) + { + } + + public override IEnumerable GetClientValidationRules() + { + Attribute.OtherPropertyDisplayName = GetOtherPropertyDisplayName(); + + var otherProp = FormatPropertyForClientValidation(Attribute.OtherProperty); + //We'll just use the built-in System.Web.Mvc client validation rule + return new[] { new ModelClientValidationGreaterThanOrEqualToRule(ErrorMessage, otherProp) }; + } + + private string GetOtherPropertyDisplayName() + { + if (Metadata.ContainerType != null && !String.IsNullOrEmpty(Attribute.OtherProperty)) + { + var propertyMetaData = ModelMetadataProviders.Current.GetMetadataForProperty(() => Metadata.Model, + Metadata.ContainerType, + Attribute.OtherProperty); + + return propertyMetaData.GetDisplayName(); + } + + return Attribute.OtherProperty; + } + + public static string FormatPropertyForClientValidation(string property) + { + if (property == null) + { + throw new ArgumentException(ClientValidationResources.Common_NullOrEmpty, "property"); + } + return "*." + property; + } + } +} \ No newline at end of file diff --git a/DataAnnotationsExtensions.ClientValidation/DataAnnotationsExtensions.ClientValidation.csproj b/DataAnnotationsExtensions.ClientValidation/DataAnnotationsExtensions.ClientValidation.csproj index 102f2a3..44528e3 100644 --- a/DataAnnotationsExtensions.ClientValidation/DataAnnotationsExtensions.ClientValidation.csproj +++ b/DataAnnotationsExtensions.ClientValidation/DataAnnotationsExtensions.ClientValidation.csproj @@ -51,13 +51,14 @@ Properties\CommonAssemblyInfo.cs + - + @@ -69,6 +70,7 @@ True ClientValidationResources.resx + diff --git a/DataAnnotationsExtensions.ClientValidation/DataAnnotationsModelValidatorProviderExtensions.cs b/DataAnnotationsExtensions.ClientValidation/DataAnnotationsModelValidatorProviderExtensions.cs index c1e163a..aca40d7 100644 --- a/DataAnnotationsExtensions.ClientValidation/DataAnnotationsModelValidatorProviderExtensions.cs +++ b/DataAnnotationsExtensions.ClientValidation/DataAnnotationsModelValidatorProviderExtensions.cs @@ -11,6 +11,8 @@ public static void RegisterValidationExtensions() DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(UrlAttribute), typeof(UrlAttributeAdapter)); DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(CreditCardAttribute), typeof(CreditCardAttributeAdapter)); DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(EqualToAttribute), typeof(EqualToAttributeAdapter)); + DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(GreaterThanAttribute), typeof(GreaterThanAttributeAdapter)); + DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(GreaterThanOrEqualToAttribute), typeof(GreaterThanOrEqualToAttributeAdapter)); DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(FileExtensionsAttribute), typeof(FileExtensionsAttributeAdapter)); DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(NumericAttribute), typeof(NumericAttributeAdapter)); DataAnnotationsModelValidatorProvider.RegisterAdapter(typeof(DigitsAttribute), typeof(DigitsAttributeAdapter)); diff --git a/DataAnnotationsExtensions.ClientValidation/Rules/ModelClientValidationGreaterThanRule.cs b/DataAnnotationsExtensions.ClientValidation/Rules/ModelClientValidationGreaterThanRule.cs new file mode 100644 index 0000000..1e4aacf --- /dev/null +++ b/DataAnnotationsExtensions.ClientValidation/Rules/ModelClientValidationGreaterThanRule.cs @@ -0,0 +1,25 @@ +using System.Web.Mvc; + +namespace DataAnnotationsExtensions.ClientValidation.Rules +{ + public class ModelClientValidationGreaterThanRule : ModelClientValidationRule + { + public ModelClientValidationGreaterThanRule(string errorMessage, string otherProperty) + { + ErrorMessage = errorMessage; + + ValidationType = "greaterthan"; + ValidationParameters.Add("other", otherProperty); + } + } + public class ModelClientValidationGreaterThanOrEqualToRule : ModelClientValidationRule + { + public ModelClientValidationGreaterThanOrEqualToRule(string errorMessage, string otherProperty) + { + ErrorMessage = errorMessage; + + ValidationType = "greaterthanorequalto"; + ValidationParameters.Add("other", otherProperty); + } + } +} \ No newline at end of file diff --git a/DataAnnotationsExtensions.Core/DataAnnotationsExtensions.Core.csproj b/DataAnnotationsExtensions.Core/DataAnnotationsExtensions.Core.csproj index 434846d..bd79c82 100644 --- a/DataAnnotationsExtensions.Core/DataAnnotationsExtensions.Core.csproj +++ b/DataAnnotationsExtensions.Core/DataAnnotationsExtensions.Core.csproj @@ -44,6 +44,7 @@ Properties\CommonAssemblyInfo.cs + diff --git a/DataAnnotationsExtensions.Core/GreaterThanEntity.cs b/DataAnnotationsExtensions.Core/GreaterThanEntity.cs new file mode 100644 index 0000000..31876e1 --- /dev/null +++ b/DataAnnotationsExtensions.Core/GreaterThanEntity.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.ComponentModel.DataAnnotations; + +namespace DataAnnotationsExtensions.Core +{ + public class GreaterThanEntity + { + [Required] + [Display(Name = "LesserDisplayName")] + public DateTime Lesser { get; set; } + + [GreaterThan("Lesser")] + [Required] + public DateTime Greater { get; set; } + } + public class GreaterThanOrEqualToEntity + { + [Required] + [Display(Name = "LesserDisplayName")] + public DateTime Lesser { get; set; } + + [GreaterThanOrEqualTo("Lesser")] + [Required] + public DateTime Greater { get; set; } + } +} diff --git a/DataAnnotationsExtensions.Tests/DataAnnotationsExtensions.Tests.csproj b/DataAnnotationsExtensions.Tests/DataAnnotationsExtensions.Tests.csproj index 16bd9fe..4752476 100644 --- a/DataAnnotationsExtensions.Tests/DataAnnotationsExtensions.Tests.csproj +++ b/DataAnnotationsExtensions.Tests/DataAnnotationsExtensions.Tests.csproj @@ -59,6 +59,8 @@ + + @@ -90,6 +92,7 @@ ResXFileCodeGenerator ErrorResources.Designer.cs + Designer diff --git a/DataAnnotationsExtensions.Tests/ValidationAttributes/GreaterThanAttributeTest.cs b/DataAnnotationsExtensions.Tests/ValidationAttributes/GreaterThanAttributeTest.cs new file mode 100644 index 0000000..b87bedd --- /dev/null +++ b/DataAnnotationsExtensions.Tests/ValidationAttributes/GreaterThanAttributeTest.cs @@ -0,0 +1,160 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace DataAnnotationsExtensions.Tests.ValidationAttributes +{ + [TestClass] + public class GreaterThanAttributeTest + { + protected CompareObject _mainObject; + protected CompareObject _otherObject; + protected ValidationContext _testContext; + protected BaseComparisonAttribute _attribute; + protected ValidationResult _result; + + [TestInitialize] + public void Initialize() + { + _mainObject = new CompareObject(DateTime.Now.Date.AddDays(2)); + _otherObject = new CompareObject(DateTime.Now.Date); + _testContext = new ValidationContext(_otherObject, null, null); + _attribute = new GreaterThanAttribute("CompareProperty"); + } + + public void Because(object value) + { + _attribute.Validate(value, _testContext); + } + public void Because() + { + Because(_mainObject.CompareProperty); + } + public void BecauseWithResult() + { + _result = _attribute.GetValidationResult(_mainObject.CompareProperty, _testContext); + } + + [TestMethod] + public void ValidateDoesNotThrowWhenComparedObjectsAreEqual() + { + Because(); + } + [TestMethod] + public void ValidateDoesNotThrowWhenComparedIntsAreEqual() + { + var mainObject = new CompareObject(4); + var otherObject = new CompareObject(2); + _testContext = new ValidationContext(otherObject, null, null); + + Because(mainObject.CompareProperty); + } + [TestMethod] + public void ValidateDoesNotThrowWhenComparedDoublesAreEqual() + { + var mainObject = new CompareObject(4); + var otherObject = new CompareObject(2); + _testContext = new ValidationContext(otherObject, null, null); + + Because(mainObject.CompareProperty); + } + + [TestMethod] + [ExpectedException(typeof(ArgumentNullException))] + public void ValidateThrowsWhenComparedToNull() + { + _attribute = new GreaterThanAttribute(null); + + Because(); + } + + + [TestMethod] + [ExpectedException(typeof(ValidationException), "'CurrentProperty' and 'CompareProperty' do not match.")] + public void ValidateThrowsWhenComparedObjectsAreNotGreater() + { + _mainObject = new CompareObject(DateTime.Now.Date.AddDays(-2)); + + Because(); + } + + [TestMethod] + [ExpectedException(typeof(ValidationException), "Could not find a property named UnknownPropertyName.")] + public void ValidateThrowsWhenPropertyNameIsUnknown() + { + _attribute = new GreaterThanAttribute("UnknownPropertyName"); + + Because(); + } + + // TODO: inheritance isn't valid; original test on EqualToAttributeTests isn't valid either b/c it should throw an exception but doesn't + //[TestMethod] + //[ExpectedException(typeof(ValidationException), "'CurrentProperty' and 'CompareProperty' do not match.")] + //public void GreaterThanAttributeCanBeDerivedFromAndOverrideIsValid() + //{ + // _mainObject = new CompareObject(DateTime.Now.Date.AddDays(-2)); + // _attribute = new DerivedGreaterThanAttribute("CompareProperty"); + + // Because(); + //} + + [TestMethod] + public void ErrorResourcesTest() + { + _mainObject = new CompareObject(DateTime.Now.Date.AddDays(-2)); + _attribute = new GreaterThanAttribute("CompareProperty") + { + ErrorMessageResourceName = "ErrorMessage", + ErrorMessageResourceType = typeof(ErrorResources) + }; + + BecauseWithResult(); + + Assert.AreEqual(ErrorResources.ErrorMessage, _result.ErrorMessage); + } + + + [TestMethod] + public void ErrorMessageTest() + { + _mainObject = new CompareObject(DateTime.Now.Date.AddDays(-2)); + + _attribute = new GreaterThanAttribute("CompareProperty") + { + ErrorMessage = "SampleErrorMessage" + }; + + BecauseWithResult(); + + Assert.AreEqual("SampleErrorMessage", _result.ErrorMessage); + } + + protected class DerivedGreaterThanAttribute : GreaterThanAttribute + { + public DerivedGreaterThanAttribute(string otherProperty) + : base(otherProperty) + { + } + + public override bool IsValid(object value) + { + return false; + } + + protected override ValidationResult IsValid(object value, ValidationContext context) + { + return null; + } + } + + protected class CompareObject + { + public T CompareProperty { get; set; } + + public CompareObject(T otherValue) + { + CompareProperty = otherValue; + } + } + } +} \ No newline at end of file diff --git a/DataAnnotationsExtensions.Tests/ValidationAttributes/GreaterThanOrEqualToAttributeTest.cs b/DataAnnotationsExtensions.Tests/ValidationAttributes/GreaterThanOrEqualToAttributeTest.cs new file mode 100644 index 0000000..17fa928 --- /dev/null +++ b/DataAnnotationsExtensions.Tests/ValidationAttributes/GreaterThanOrEqualToAttributeTest.cs @@ -0,0 +1,37 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace DataAnnotationsExtensions.Tests.ValidationAttributes +{ + [TestClass] + public class GreaterThanOrEqualToAttributeTest : GreaterThanAttributeTest + { + [TestInitialize] + public void Initialize() + { + base.Initialize(); + _attribute = new GreaterThanOrEqualToAttribute("CompareProperty"); + } + + [TestMethod] + public void ValidateDoesNotThrowWhenComparedDoublesAreEqual() + { + var mainObject = new CompareObject(4); + var otherObject = new CompareObject(4); + _testContext = new ValidationContext(otherObject, null, null); + + Because(mainObject.CompareProperty); + } + [TestMethod] + [ExpectedException(typeof(ValidationException), "'CurrentProperty' and 'CompareProperty' do not match.")] + public void ValidateThrowsWhenComparedDoublesAreLessThan() + { + var mainObject = new CompareObject(4); + var otherObject = new CompareObject(14); + _testContext = new ValidationContext(otherObject, null, null); + + Because(mainObject.CompareProperty); + } + } +} \ No newline at end of file diff --git a/DataAnnotationsExtensions.Web/Controllers/GreaterThanController.cs b/DataAnnotationsExtensions.Web/Controllers/GreaterThanController.cs new file mode 100644 index 0000000..50011c0 --- /dev/null +++ b/DataAnnotationsExtensions.Web/Controllers/GreaterThanController.cs @@ -0,0 +1,11 @@ +using DataAnnotationsExtensions.Core; + +namespace DataAnnotationsExtensions.Web.Controllers +{ + public class GreaterThanController : ValidationControllerBase + { + } + public class GreaterThanOrEqualToController : ValidationControllerBase + { + } +} diff --git a/DataAnnotationsExtensions.Web/DataAnnotationsExtensions.Web.csproj b/DataAnnotationsExtensions.Web/DataAnnotationsExtensions.Web.csproj index 8715815..ca5c555 100644 --- a/DataAnnotationsExtensions.Web/DataAnnotationsExtensions.Web.csproj +++ b/DataAnnotationsExtensions.Web/DataAnnotationsExtensions.Web.csproj @@ -61,6 +61,7 @@ Properties\CommonAssemblyInfo.cs + @@ -97,6 +98,8 @@ + + @@ -201,6 +204,7 @@ + diff --git a/DataAnnotationsExtensions.Web/Scripts/jquery.validate.additional-methods.js b/DataAnnotationsExtensions.Web/Scripts/jquery.validate.additional-methods.js new file mode 100644 index 0000000..b4869fd --- /dev/null +++ b/DataAnnotationsExtensions.Web/Scripts/jquery.validate.additional-methods.js @@ -0,0 +1,12 @@ +jQuery.validator.addMethod("greaterThan", function (value, element, param) { + var target = $(param).unbind(".validate-greaterThan").bind("change.validate-greaterThan", function () { + $(element).valid(); + }); + return (Date.parse(value) || parseFloat(value)) > (Date.parse($(param).val()) || parseFloat($(param).val())); +}); +jQuery.validator.addMethod("greaterThanOrEqualTo", function (value, element, param) { + var target = $(param).unbind(".validate-greaterThanOrEqualTo").bind("change.validate-greaterThanOrEqualTo", function () { + $(element).valid(); + }); + return (Date.parse(value) || parseFloat(value)) >= (Date.parse($(param).val()) || parseFloat($(param).val())); +}); \ No newline at end of file diff --git a/DataAnnotationsExtensions.Web/Scripts/jquery.validate.unobtrusive.additional-methods.js b/DataAnnotationsExtensions.Web/Scripts/jquery.validate.unobtrusive.additional-methods.js new file mode 100644 index 0000000..bcef053 --- /dev/null +++ b/DataAnnotationsExtensions.Web/Scripts/jquery.validate.unobtrusive.additional-methods.js @@ -0,0 +1,77 @@ +function baseUnobtrusiveAdapterFunctions() { + function getModelPrefix(fieldName) { + return fieldName.substr(0, fieldName.lastIndexOf(".") + 1); + } + + function appendModelPrefix(value, prefix) { + if (value.indexOf("*.") === 0) { + value = value.replace("*.", prefix); + } + return value; + } + function setValidationValues(options, ruleName, value) { + options.rules[ruleName] = value; + if (options.message) { + options.messages[ruleName] = options.message; + } + } + function getElement(options) { + var prefix = getModelPrefix(options.element.name), + other = options.params.other, + fullOtherName = appendModelPrefix(other, prefix), + element = $(options.form).find("input[name='" + fullOtherName + "']")[0]; + return element; + } +} + +jQuery.validator.unobtrusive.adapters.add("greaterthan", ["other"], function (options) { + function getModelPrefix(fieldName) { + return fieldName.substr(0, fieldName.lastIndexOf(".") + 1); + } + + function appendModelPrefix(value, prefix) { + if (value.indexOf("*.") === 0) { + value = value.replace("*.", prefix); + } + return value; + } + function setValidationValues(options, ruleName, value) { + options.rules[ruleName] = value; + if (options.message) { + options.messages[ruleName] = options.message; + } + } + + var prefix = getModelPrefix(options.element.name), + other = options.params.other, + fullOtherName = appendModelPrefix(other, prefix), + element = $(options.form).find("input[name='" + fullOtherName + "']")[0]; + + setValidationValues(options, "greaterThan", element); +}); +jQuery.validator.unobtrusive.adapters.add("greaterthanorequalto", ["other"], function (options) { + function getModelPrefix(fieldName) { + return fieldName.substr(0, fieldName.lastIndexOf(".") + 1); + } + + function appendModelPrefix(value, prefix) { + if (value.indexOf("*.") === 0) { + value = value.replace("*.", prefix); + } + return value; + } + function setValidationValues(options, ruleName, value) { + options.rules[ruleName] = value; + if (options.message) { + options.messages[ruleName] = options.message; + } + } + + var prefix = getModelPrefix(options.element.name), + other = options.params.other, + fullOtherName = appendModelPrefix(other, prefix), + element = $(options.form).find("input[name='" + fullOtherName + "']")[0]; + + + setValidationValues(options, "greaterThanOrEqualTo", element); +}); diff --git a/DataAnnotationsExtensions.Web/Views/GreaterThan/Create.cshtml b/DataAnnotationsExtensions.Web/Views/GreaterThan/Create.cshtml new file mode 100644 index 0000000..46a611d --- /dev/null +++ b/DataAnnotationsExtensions.Web/Views/GreaterThan/Create.cshtml @@ -0,0 +1,25 @@ +@model DataAnnotationsExtensions.Core.GreaterThanEntity + +@{ + ViewBag.Title = "Create"; +} + +

Create

+ +@using (Html.BeginForm()) { + @Html.ValidationSummary(true) +
+ Fields + + @Html.EditorForModel() + +

+ +

+
+} + +
+ @Html.ActionLink("Back to demos", "Demos", "Home") +
+ diff --git a/DataAnnotationsExtensions.Web/Views/GreaterThanOrEqualTo/Create.cshtml b/DataAnnotationsExtensions.Web/Views/GreaterThanOrEqualTo/Create.cshtml new file mode 100644 index 0000000..d345de6 --- /dev/null +++ b/DataAnnotationsExtensions.Web/Views/GreaterThanOrEqualTo/Create.cshtml @@ -0,0 +1,25 @@ +@model DataAnnotationsExtensions.Core.GreaterThanOrEqualToEntity + +@{ + ViewBag.Title = "Create"; +} + +

Create

+ +@using (Html.BeginForm()) { + @Html.ValidationSummary(true) +
+ Fields + + @Html.EditorForModel() + +

+ +

+
+} + +
+ @Html.ActionLink("Back to demos", "Demos", "Home") +
+ diff --git a/DataAnnotationsExtensions.Web/Views/Shared/_Layout.cshtml b/DataAnnotationsExtensions.Web/Views/Shared/_Layout.cshtml index 61723eb..8b57286 100644 --- a/DataAnnotationsExtensions.Web/Views/Shared/_Layout.cshtml +++ b/DataAnnotationsExtensions.Web/Views/Shared/_Layout.cshtml @@ -71,6 +71,8 @@ + +