using System.ComponentModel.DataAnnotations;
public class Customer
{
public int CustomerID { get; set; }
[Required(ErrorMessage = "你的名字是啥?快填!")]
[Display(Name="名字")]
public string FirstName { get; set; }
[Required]
[Display(Name = "姓")]
public string LastName { get; set; }
[Required]
[StringLength(10,ErrorMessage="the company name must less than 10 characters!")]
[Display(Name="公司名稱")]
public string Company { get; set; }
[Required]
public string Email { get; set; }
[NotMapped]
[Compare("Email", ErrorMessage = "Please enter the same email!")]
public string EmailCheck { get; set; }
}
public class Product
{
public int ProductID { get; set; }
[Required]
public string Title { get; set; }
[Required]
public string Description { get; set; }
[Range(0.0,5000.0,ErrorMessage="the range is between 0 and 5000!")]
public double Price { get; set; }
}