Startpunkten
This commit is contained in:
36
Models/Person.cs
Normal file
36
Models/Person.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace PersonSport.Models {
|
||||
public class Person {
|
||||
[Required]
|
||||
public int PersonId { get; set; }
|
||||
|
||||
[Required(ErrorMessage ="Du måste ange ditt namn")]
|
||||
[StringLength(50, MinimumLength = 3, ErrorMessage = "Namnet måste vara mellan 3 och 50 tecken")]
|
||||
[Display(Name = "Ditt namn")]
|
||||
public string PersonNamn { get; set; }
|
||||
|
||||
[Required(ErrorMessage="Du måste ange din e-postadress")]
|
||||
[StringLength(50, MinimumLength = 6)]
|
||||
[Display(Name = "Din E-postadress")]
|
||||
[RegularExpression(@"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$", ErrorMessage = "Felaktig e-postadress")]
|
||||
public string Epost { get; set; }
|
||||
|
||||
[Required(ErrorMessage="Du måste ange hur många år du är")]
|
||||
[Range(8, 99, ErrorMessage = "Din ålder måste vara mellan 8 och 99 år")]
|
||||
[Display(Name = "Ålder")]
|
||||
public int Alder { get; set; }
|
||||
|
||||
[Display(Name = "Registrerad")]
|
||||
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-d}")]
|
||||
[DataType(DataType.DateTime)]
|
||||
public DateTime StartDatum { get; set; }
|
||||
|
||||
[StringLength(80, MinimumLength = 3, ErrorMessage = "Bildens namn måste vara mellan 3 och 80 tecken")]
|
||||
public string Visningsbild { get; set; }
|
||||
|
||||
public virtual ICollection<PersonSport> PersonSporter { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user