Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
 private static bool FeedbackEnabled(FeedbackForm state) =>
 !string.IsNullOrWhiteSpace(state.Contact) && !string.IsNullOrWhiteSpace(state.Name);