using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace MVCWebApp.Models
{
public class UserRegistrationModel
{
[Required(ErrorMessage = "Please Enter Name e.g. John Doe")]
[StringLength(30, MinimumLength = 3)]
public string Name { get; set; }
[Required(ErrorMessage = "Please Provide Gender")]
public bool Gender { get; set; }
[Range(18, 60)]
public string Age { get; set; }
[Required]
[DataType(DataType.Date)]
[Display(Name = "Date Of Birth")]
public DateTime? DateOfBirth { get; set; }
[StringLength(200)]
public string Address { get; set; }
[StringLength(35)]
public string City { get; set; }
[Required(ErrorMessage = "Please Enter Mobile No")]
[Display(Name = "Mobile")]
[StringLength(10, ErrorMessage = "The Mobile must contains 10 characters", MinimumLength = 10)]
public string Phone { get; set; }
[Required(ErrorMessage = "Required.")]
[EmailAddress(ErrorMessage = "Invalid email address.")]
public string Email { get; set; }
[Required(ErrorMessage = "Please Enter Email Address")]
[Display(Name = "User Name")]
[RegularExpression(".+@.+\\..+", ErrorMessage = "Please Enter Correct Email Address")]
public string UserName { get; set; }
[Required(ErrorMessage = "Please Enter Password")]
[StringLength(50, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[Required(ErrorMessage = "Please Enter Confirm Password")]
[StringLength(50, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Confirm password")]
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
}
}
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace MVCWebApp.Models
{
public class UserRegistrationModel
{
[Required(ErrorMessage = "Please Enter Name e.g. John Doe")]
[StringLength(30, MinimumLength = 3)]
public string Name { get; set; }
[Required(ErrorMessage = "Please Provide Gender")]
public bool Gender { get; set; }
[Range(18, 60)]
public string Age { get; set; }
[Required]
[DataType(DataType.Date)]
[Display(Name = "Date Of Birth")]
public DateTime? DateOfBirth { get; set; }
[StringLength(200)]
public string Address { get; set; }
[StringLength(35)]
public string City { get; set; }
[Required(ErrorMessage = "Please Enter Mobile No")]
[Display(Name = "Mobile")]
[StringLength(10, ErrorMessage = "The Mobile must contains 10 characters", MinimumLength = 10)]
public string Phone { get; set; }
[Required(ErrorMessage = "Required.")]
[EmailAddress(ErrorMessage = "Invalid email address.")]
public string Email { get; set; }
[Required(ErrorMessage = "Please Enter Email Address")]
[Display(Name = "User Name")]
[RegularExpression(".+@.+\\..+", ErrorMessage = "Please Enter Correct Email Address")]
public string UserName { get; set; }
[Required(ErrorMessage = "Please Enter Password")]
[StringLength(50, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[Required(ErrorMessage = "Please Enter Confirm Password")]
[StringLength(50, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Confirm password")]
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
}
}
Comments
Post a Comment