Exemplo n.º 1
0
 private void InvalidEmailAddressFormatValidation(RegisterAdminDto dto)
 {
     if (dto.Email.IsValidEmail() == false)
     {
         throw new InvalidEmailAddressFormatException();
     }
 }
Exemplo n.º 2
0
 private async Task EmailIsAlreadyRegisteredValidation(RegisterAdminDto dto)
 {
     if (await context.Customers.AnyAsync(o => o.Email == dto.Email))
     {
         throw new EmailIsAlreadyRegisteredException();
     }
 }
Exemplo n.º 3
0
 private void EmailAddressIsRequiredValidation(RegisterAdminDto dto)
 {
     if (string.IsNullOrWhiteSpace(dto.Email))
     {
         throw new EmailAddressIsRequiredException();
     }
 }
Exemplo n.º 4
0
 private async Task UsernameIsAlreadyRegisteredValidation(RegisterAdminDto dto)
 {
     if (await context.Users.AnyAsync(o => o.Username == dto.Username))
     {
         throw new UsernameIsAlreadyRegisteredException();
     }
 }
Exemplo n.º 5
0
 public RegisterAdminCommand(RegisterAdminDto dto) => this.Dto = dto;