private static bool IsTimeAdded(MakeBooking state) { if (state.Date.TimeOfDay.TotalSeconds == 0) { return(true); } return(false); }
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)); }
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)); }