c# - MVC5 - How to validate compound checks? -


i working on mvc razor project needs more complex input validations. using viewmodels remove access data model controller without going through logic layer. need solve how following types of validations:

user selected date after date value:

// read user public datetime startdate { get; set; } // must after startdate public datetime occurredat { get; set; } 

sum of user inputs n (variable) fields not exceed value of field.

// read user public double startingamount { get; set; } // sum of these fields must less starting amount public double amounttransfered { get; set; } public double amountlosses { get; set; } public double amountsampled { get; set; }  // validation check if (startingamount - (amounttransfered + amountlosses + amountsampled) > 0)   isvalid = true; 

i new mvc, , validation things find on google 2010 , loaded javascript custom implementations.

i hoping there newer mechanisms perform compound validation using attributes define fields related. suspect solution both of these similar, different set of parameters , data types.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -