File size: 1,345 Bytes
3418204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TaskTrackingSystem.Shared.Models.User
{
        public class CreateUserDto
        {
            [Required, MaxLength(50)]
            [MinLength(3, ErrorMessage = ResultMessages.UsernameMinLength)]
            [RegularExpression(@"^[a-zA-Z0-9._]+$", ErrorMessage = ResultMessages.UsernameInvalidCharacters)]
            public string Username { get; set; } = string.Empty; 

            [Required, MaxLength(50)]
            public string FirstName { get; set; } = string.Empty;

            [Required, MaxLength(50)]
            public string LastName { get; set; } = string.Empty;

            [Required, EmailAddress, MaxLength(256)]
            public string Email { get; set; } = string.Empty;

            [Required]
            [MinLength(8, ErrorMessage = ResultMessages.PasswordMinLengthRule)]
            [RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^a-zA-Z0-9]).+$", ErrorMessage = ResultMessages.PasswordComplexityRule)]
            public string Password { get; set; } = string.Empty;

            [MaxLength(20)]
            public string? Phone { get; set; }

            [Required]
            public long RoleId { get; set; }
        }
    }