Beispiel #1
0
 private static bool IsTimeAdded(MakeBooking state)
 {
     if (state.Date.TimeOfDay.TotalSeconds == 0)
     {
         return(true);
     }
     return(false);
 }
Beispiel #2
0
        private static Task <ValidateResult> ValidatePhNum(MakeBooking 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 = "Make sure the phone number you entered are all numbers.";
            }
            return(Task.FromResult(result));
        }
Beispiel #3
0
        private static Task <ValidateResult> ValidateTime(MakeBooking state, object response)
        {
            var result = new ValidateResult();
            var dt     = (DateTime)response;

            // Do the checks here whether the time is available.
            // Hard coded for demo purposes
            if (dt.ToString("HH:mm") == "20:30")
            {
                // If time not available
                result.IsValid  = false;
                result.Feedback = "Sorry, that time is not available! Times that are available are: 6.30pm, 7.00pm, 8.00pm, 9.00pm";
            }
            else
            {
                result.IsValid = true;
                result.Value   = response;
            }
            return(Task.FromResult(result));
        }