Example #1
0
        public object GetBodyFromFeedback(Feedback feedback)
        {
            if (feedback == null)
            {
                return(null);
            }

            var response = new Response(null);

            switch (feedback)
            {
            case AcknowledgmentFeedback acknowledgmentFeedback:
                _modifier.AddAcknowledgment(response, acknowledgmentFeedback.Acknowledgment);
                return(response.ExtraBody);

            case ErrorFeedback errorFeedback:
                _modifier.AddError(response, errorFeedback.Error);     // TODO showDeveloperErrors ?
                return(response.ExtraBody);

            case MultiFeedback multiFeedback:
                return(multiFeedback.FeedbackItems.Select(GetBodyFromFeedback).ToArray());

            default:
                throw new ArgumentOutOfRangeException(nameof(feedback.Type), "Invalid feedback type.");
            }
        }
Example #2
0
        public void AddFeedback(Feedback feedback)
        {
            switch (feedback)
            {
            case AcknowledgmentFeedback acknowledgmentFeedback:
                _modifier.AddAcknowledgment(_response, acknowledgmentFeedback.Acknowledgment);
                break;

            case ErrorFeedback errorFeedback:
                _modifier.AddError(_response, errorFeedback.Error);
                break;

            case MultiFeedback multiFeedback:
                _modifier.AddMultiFeedback(_response, multiFeedback.FeedbackItems);
                break;
            }
        }