init
This commit is contained in:
31
ContosoUniversity.Models/Person.cs
Normal file
31
ContosoUniversity.Models/Person.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ContosoUniversity.Models
|
||||
{
|
||||
public abstract class Person
|
||||
{
|
||||
public int ID { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(50)]
|
||||
[Display(Name = "Last Name")]
|
||||
public string LastName { get; set; }
|
||||
|
||||
[RegularExpression("\\D+", ErrorMessage = "Blah!")]
|
||||
[Required]
|
||||
[StringLength(50, ErrorMessage = "First name cannot be longer than 50 characters.")]
|
||||
[Column("FirstName")]
|
||||
[Display(Name = "First Name")]
|
||||
public string FirstMidName { get; set; }
|
||||
|
||||
[Display(Name = "Full Name")]
|
||||
public string FullName
|
||||
{
|
||||
get
|
||||
{
|
||||
return LastName + ", " + FirstMidName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user