Using Data Annotations to validate fields in an HTML page and Web API

4

Someone has an example of how to create a field validation on an HTML page using Data Annotation, Web API and C #.

In MVC with you, this is easily accomplished by using Wizard when creating a View.

    
asked by anonymous 16.12.2014 / 19:51

1 answer

1

First the DataAnnotation are the properties that stay on top of the fields of your model

ex:

[Required]
[Display(Name = "User name")]
[EmailAddress(ErrorMessage = "E-mail em formato inválido.")]

A simple and straightforward article: link

    
16.12.2014 / 20:22