I finished! On to the next chapter

Outline

Demo: Create Register Request

In the Conduit.Models Project

Add a new class named Register.cs (This will hold the data that is sent in during Registration).

Add the following properties:
  • UserName type string
    • Required
    • Max Length 50 Characters
  • Email type string
    • Required
    • Email Address
    • Max Length 50 Characters
  • Password type string
    • Required
    • Restrict Password with RegEx (see below)

Result of the C# Code:

using System.ComponentModel.DataAnnotations;

namespace Conduit.Models.Requests
{
    public class Register
    {
        [Required(ErrorMessage = "User name is required.")]
        [MaxLength(50, ErrorMessage = "User name max length is 50 characters.")]
        public string UserName { get; set; }

        [Required(ErrorMessage = "Email is required.")]
        [EmailAddress(ErrorMessage = "Email address must be valid.")]
        [MaxLength(50, ErrorMessage = "Email max length is 50 characters.")]
        public string Email { get; set; }

        [Required(ErrorMessage = "Password is required.")]
        [RegularExpression(@"^((?=.*[a-z])(?=.*[A-Z])(?=.*\d)).+$", ErrorMessage = "Password must contain 1 Lower-case, 1 Upper-case and 1 Numeric character.")]
        public string Password { get; set; }
    }
}