private string GenerateEmailMessage(FeedbackForm feedback) { StringBuilder sb = new StringBuilder(); sb.AppendLine($"Message from: {feedback.Name}"); sb.AppendLine($"Contact: {feedback.Contact}"); sb.AppendLine($"Message: {feedback.Feedback}"); return(sb.ToString()); }
private static Task <ValidateResult> ValidateContactInformation(FeedbackForm state, object response) { var result = new ValidateResult(); string contactInfo = string.Empty; if (GetTwitterHandle((string)response, out contactInfo) || GetEmailAddress((string)response, out contactInfo)) { result.IsValid = true; result.Value = contactInfo; } else { result.IsValid = false; result.Feedback = "You did not enter valid email address or twitter handle. Make sure twitter handle starts with @."; } return(Task.FromResult(result)); }
private static bool FeedbackEnabled(FeedbackForm state) => !string.IsNullOrWhiteSpace(state.Contact) && !string.IsNullOrWhiteSpace(state.Name);