Beispiel #1
0
        private static Task <ValidateResult> ValidatePhNum(BookingForm2 state, object response)
        {
            var    result      = new ValidateResult();
            string phoneNumber = string.Empty;

            if (IsPhNum((string)response))
            {
                result.IsValid = true;
                result.Value   = response;
            }
            else
            {
                result.IsValid  = false;
                result.Feedback = "El número de teléfono introducido no es válido.";
            }
            return(Task.FromResult(result));
        }
Beispiel #2
0
        /*private static bool BookingEnabled(BookingForm state) =>
         *  !string.IsNullOrWhiteSpace(state.Email) && !string.IsNullOrWhiteSpace(state.Name);
         */

        private static Task <ValidateResult> ValidateName(BookingForm2 state, object response)
        {
            var    result = new ValidateResult();
            string name   = (string)response;

            if (!Regex.Match(name, @"^[a-zA-Z ]*$").Success)
            {
                result.IsValid  = false;
                result.Feedback = "Nombre no válido. Por favor, introduce únicamente letras.";
            }
            else
            {
                result.IsValid = true;
                result.Value   = response;
            }
            return(Task.FromResult(result));
        }