This commit is contained in:
MarcEricMartel
2022-09-12 15:21:11 -07:00
parent 166db82ed3
commit e6959a82f2
3 changed files with 20 additions and 13 deletions

View File

@@ -9,9 +9,13 @@ namespace GrossesMitaines.Models
{
public class RequestViewModel
{
[Display(Prompt ="NOM COMPLET")]
public string Name { get; set; }
[Display(Prompt = "COURRIEL")]
public string Email { get; set; }
[Display(Prompt = "TÉLÉPHONE")]
public string Phone { get; set; }
[Display(Prompt = "VOS COMMENTAIRES")]
public string Message { get; set; }
}
@@ -24,12 +28,12 @@ namespace GrossesMitaines.Models
.MinimumLength(2).WithMessage("Votre nom doit être de 2 lettres minimum");
RuleFor(x => x.Email)
.NotEmpty().WithMessage("Un Email est requis")
.Matches("^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$").WithMessage("Format non valide!");
.NotEmpty().WithMessage("Une adresse courriel est requise")
.EmailAddress().WithMessage("Format non valide!");
RuleFor(x => x.Phone)
.NotEmpty().WithMessage("Vous devez entrer votre téléphone")
.Matches("^[0-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]$").WithMessage("Téléphone non valide!");
.Matches("^\\s*(?:\\+?(\\d{1}))?[-. (]*(\\d{3})[-. )]*(\\d{3})[-. ]*(\\d{4})$").WithMessage("Téléphone non valide!");
}
}
}