public static Result <PwdAuthCmd> Create(string password, string email) { return(ParametersValidation.Validate( ParametersValidation.NotNullOrWhiteSpace(password, nameof(password)), ParametersValidation.NotNullOrWhiteSpace(email, nameof(email)) ) .Combine() .Map(() => new PwdAuthCmd(password, email))); }
public static Result <PwdRegistrationCmd> Create(string password, string passwordConfirm, string email) { return(ParametersValidation.Validate( ParametersValidation.NotNullOrWhiteSpace(password, nameof(password)), ParametersValidation.Ensure(() => password == passwordConfirm, nameof(passwordConfirm)), ParametersValidation.NotNullOrWhiteSpace(email, nameof(email)), ParametersValidation.Ensure(() => new EmailAttribute().IsValid(email), nameof(email)) ) .Combine() .Map(() => new PwdRegistrationCmd(password, email))); }