Incorporating EmailAddress validation in blogging system models

We will update our blogging system model to accommodate the EmailAddress field validation in the View model:

    public class RegistrationViewModel
{
// Code removed for brevity
[Required(ErrorMessage = "Email is required")]
[EmailAddress(ErrorMessage = "Provide a valid email address")]
public string Email { get; set; }
[Required(ErrorMessage = "Email is required")]
[EmailAddress(ErrorMessage = "Provide a valid email address")]
public string ConfirmEmail { get; set; }
}

We have looked, exhaustively, at EmailAddress field validations; let's explore the Compare validation in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset