In this example you validate the Phone property with a regular expression for US phone numbers.At this stage, the User Profile Metadata class is just an independent class in your project.
Id, First Name, Last Name, Email, Bio, Age, Blog Url and Phone.
Once you create the User Profile table make sure to add an ADO.
All of the above attributes also allow you to specify an error message that is displayed in the event of an error.
If an error message is not specified, a default error message is displayed.
Add the following code to the Home Controller class.
The Home Controller class contains two versions of the Index() action method.The [Metadata Type] attribute accepts the type of the class that is supplying metadata information to the User Profile class (User Profile Metadata in this case).Now, add a new controller in the Controllers folder and name it Home Controller.The User Profile Metadata class contains property definitions for First Name, Last Name, Email, Bio, Age, Blog Url and Phone.Notice the attributes that are used to decorate these properties.The [Range] attribute checks whether a property value falls between a minimum and a maximum value.