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