一个或多个实体的验证失败。有关详细信息,请参阅“EntityValidationError”属性
一个或多个实体的验证失败。有关详细信息,请参阅“EntityValidationError”属性。
namespace Data.Model{ public class Position { [DatabaseGenerated(System.ComponentModel.DataAnnotations.DatabaseGeneratedOption.Identity)] public int PositionID { get; set; } [Required(ErrorMessage = "Position name is required.")] [StringLength(20, MinimumLength = 3, ErrorMessage = "Name should not be longer than 20 characters.")] [Display(Name = "Position name")] public string name { get; set; } [Required(ErrorMessage = "Number of years is required")] [Display(Name = "Number of years")] public int yearsExperienceRequired { get; set; } public virtual ICollection<ApplicantPosition> applicantPosition { get; set; } } public class Applicant { [DatabaseGenerated(System.ComponentModel.DataAnnotations.DatabaseGeneratedOption.Identity)] public int ApplicantID { get; set; } [Required(ErrorMessage = "Name is required")] [StringLength(20, MinimumLength = 3, ErrorMessage="Name should not be longer than 20 characters.")] [Display(Name = "First and LastName")] public string name { get; set; } [Required(ErrorMessage = "Telephone number is required")] [StringLength(10, MinimumLength = 3, ErrorMessage = "Telephone should not be longer than 20 characters.")] [Display(Name = "Telephone Number")] public string telephone { get; set; } [Required(ErrorMessage = "Skype username is required")] [StringLength(10, MinimumLength = 3, ErrorMessage = "Skype user should not be longer than 20 characters.")] [Display(Name = "Skype Username")] }
慕田峪9158850