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.