Here's a complete code listing for the updated Notice how the form has automatically used a red border color to highlight the text boxes that contain invalid data and has emitted an appropriate validation error message next to each one.The errors are enforced both client-side (using Java Script and j Query) and server-side (in case a user has Java Script disabled).
If there are no errors, the method saves the new movie in the database.
In our movie example we are using, the form is not posted to the server when their are validation errors detected on the client side; the second method and verify the method is never called, client side validation will not submit the form data when validation errors are detected.
If you want to change the validation logic later, you can do so in exactly one place by adding validation attributes to the model (in this example, the class).
You won't have to worry about different parts of the application being inconsistent with how the rules are enforced — all validation logic will be defined in one place and used everywhere.
NET Framework helps make your application more robust.