You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CustomerCreateDTO.cs 1.4KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.ComponentModel.DataAnnotations;
  2. namespace Diligent.WebAPI.Host.DTOs.Customer
  3. {
  4. public class CustomerCreateDTO
  5. {
  6. [RegularExpression(@"^[a-zA-Z0-9]+$", ErrorMessage = "First Name should not contain special characters")]
  7. [Required(ErrorMessage = "Field First Name should not be empty")]
  8. public string FirstName { get; set; }
  9. [RegularExpression(@"^[a-zA-Z0-9]+$", ErrorMessage = "Last Name should not contain special characters")]
  10. [Required(ErrorMessage = "Field Last Name should not be empty")]
  11. public string LastName { get; set; }
  12. [Required(ErrorMessage = "Field E-mail should not be empty")]
  13. [EmailAddress(ErrorMessage = "Category Name should not be empty")]
  14. public string Email { get; set; }
  15. [Required(ErrorMessage = "Field Username should not be empty")]
  16. [MinLength(8, ErrorMessage = "Username must have a minimum length of 6 characters")]
  17. public string Username { get; set; }
  18. [Required(ErrorMessage = "Field Password should not be empty")]
  19. [RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,32}$", ErrorMessage = "Password must be between 8 and 32 characters and contain one uppercase letter, one lowercase letter, one digit and one special character.")]
  20. [MinLength(8, ErrorMessage = "Password must have a minimum length of 8 characters")]
  21. public string Password { get; set; }
  22. }
  23. }