Incorporating the Compare validation in blogging system models

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

    public class LoginViewModel
{
[Required(ErrorMessage = "Username is required")]
public string Username { get; set; }
[Required(ErrorMessage = "Password is required")]
public string Password { get; set; }
[Required(ErrorMessage = "ConfirmPassword is required")]
[Compare("Password", ErrorMessage = "Password does not match")]
public string ConfirmPassword { get; set; }
}

We have looked, exhaustively, at the Compare field validations. Let's explore the Url 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