| | 1 | | using Despesas.Application.Dtos.Core; |
| | 2 | | using System.ComponentModel; |
| | 3 | | using System.ComponentModel.DataAnnotations; |
| | 4 | | using System.Text.Json.Serialization; |
| | 5 | |
|
| | 6 | | namespace Despesas.Application.Dtos; |
| | 7 | | public class AcessoDto : BaseDto, IValidatableObject |
| | 8 | | { |
| | 9 | | [Required(ErrorMessage = "O campo Nome é obrigatório.")] |
| 16 | 10 | | public string? Nome { get; set; } |
| | 11 | |
|
| 16 | 12 | | public string? SobreNome { get; set; } |
| | 13 | |
|
| | 14 | | [Required(ErrorMessage = "O campo Telefone é obrigatório.")] |
| 17 | 15 | | public string? Telefone { get; set; } |
| | 16 | |
|
| | 17 | | [EmailAddress(ErrorMessage = "O campo Email é inválido.")] |
| | 18 | | [Required(ErrorMessage = "O campo Email é obrigatório.")] |
| 18 | 19 | | public string? Email { get; set; } |
| | 20 | |
|
| | 21 | | [Required(ErrorMessage = "O campo Senha é obrigatório.")] |
| | 22 | | [PasswordPropertyText] |
| 27 | 23 | | public string? Senha { get; set; } |
| | 24 | |
|
| | 25 | | [Required(ErrorMessage = "O campo Confirma Senha é obrigatório.")] |
| | 26 | | [PasswordPropertyText] |
| 17 | 27 | | public string? ConfirmaSenha { get; set; } |
| | 28 | |
|
| | 29 | | [JsonIgnore] |
| 1 | 30 | | public string? ExternalProvider { get; set; } |
| | 31 | |
|
| | 32 | | [JsonIgnore] |
| 1 | 33 | | public string? ExternalId { get; set; } |
| | 34 | | public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
| 0 | 35 | | { |
| | 36 | |
|
| 0 | 37 | | if (string.IsNullOrEmpty(ConfirmaSenha) || string.IsNullOrWhiteSpace(ConfirmaSenha)) |
| 0 | 38 | | yield return new ValidationResult("Campo Confirma Senha não pode ser em branco ou nulo"); |
| | 39 | |
|
| 0 | 40 | | if (Senha != ConfirmaSenha) |
| 0 | 41 | | yield return new ValidationResult("Senha e Confirma Senha são diferentes!"); |
| 0 | 42 | | } |
| | 43 | | } |