This file contains 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 characters
public class HomePageViewModel | |
{ | |
[Display(Order=0, Name="Full Name")] | |
[Required(ErrorMessage="Full Name is Required")] | |
public string Name { get; set; } | |
[Display(Order=1, Name="Birthday") ] | |
[DateComparer(MaxDateAddDaysFromNow=0, MinDateSelector="PropertyDate")] | |
//Must be less than Now and Greater than the sibling property PropertyDate | |
public DateTime BirthDate { get; set; } |
This file contains 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 characters
(function ($) { | |
// The adapter to support ASP.NET MVC unobtrusive validation | |
$.validator.unobtrusive.adapters.add('rangedate', ['minselector', 'maxselector', 'mindate', 'maxdate', 'nullable'], | |
function(options) { | |
var params = { | |
minSelector: options.params.minselector, | |
maxSelector: options.params.maxselector, | |
minDate: options.params.mindate, |
This file contains 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 characters
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] | |
public class DateComparerAttribute : ValidationAttribute, IClientValidatable | |
{ | |
/// <summary> | |
/// If set will use DateTime.AddDays to specify the Min Valid Date | |
/// </summary> | |
public double MinDateAddDaysFromNow | |
{ | |
get { return _minDateAddDaysFromNow; } | |
set |
This file contains 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 characters
[ServiceContract] | |
public interface ICustomerService | |
{ | |
[OperationContract] | |
Customer GetCustomer(int id); | |
[OperationContract] | |
void SaveCustomer(ref Customer customer); | |
} |