31 lines
830 B
C#
31 lines
830 B
C#
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;
|
|
}
|
|
}
|
|
}
|
|
} |