e.g. 3.13 Applying Validation to the GuestResponse Model Class
This commit is contained in:
parent
c53172cfb7
commit
82fd44ba0f
@ -1,10 +1,22 @@
|
||||
namespace PartyInvites.Models
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace PartyInvites.Models
|
||||
{
|
||||
public class GuestResponse
|
||||
{
|
||||
[Required(ErrorMessage = "Please enter your name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "Please enter your email address")]
|
||||
[RegularExpression(".+\\@.+\\..+",
|
||||
ErrorMessage = "Please enter a valid email address")]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "Please enter your name")]
|
||||
public string Phone { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "Please specify whether you'll attend")]
|
||||
public bool? WillAttend { get; set; }
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user