Exemplo n.º 1
0
        private static void Update(Contact contact)
        {
            var firstName = PromptE.Input("First name", contact.FirstName,
                                          new[] { new MinLengthValidator("First name", 3), });

            var middleName = PromptE.Input("Middle name", contact.MiddleName, new[] {
                new MinLengthValidator("Middle name", 3, true),
            });

            var lastName = PromptE.Input("Last name", contact.LastName, new[] {
                new MinLengthValidator("Last name", 3),
            });

            var email = PromptE.Input("Email", contact.Email, new InputValidator <string>[] {
                new MinLengthValidator("Email name", 3),
                new EmailValidator(),
            });

            var cellphone = PromptE.Input("Cellphone number", contact.CellphoneNumber,
                                          new InputValidator <string>[] {
                new MinLengthValidator("Cellphone number", 3),
                new CellphoneValidator(),
            });

            contact.FirstName       = firstName;
            contact.MiddleName      = middleName;
            contact.LastName        = lastName;
            contact.Email           = email;
            contact.CellphoneNumber = CellphoneUtils.Parse(cellphone);
        }
Exemplo n.º 2
0
        protected override string GetValidation(string input)
        {
            if (!CellphoneUtils.IsValid(input))
            {
                return("Invalid cellphone number! (valid example +12 23 4455-66779)");
            }

            return(null);
        }