// Inserts the collected data to the connected database (helper method)
        private void InsertFeedbackFormItem(FeedbackFormMessageConsentModel feedback)
        {
            // Creates a form item containing the collected data
            var item = new FeedbackFormItemConsent
            {
                UserName     = feedback.FirstName,
                UserLastName = feedback.LastName,
                UserEmail    = feedback.Email,
                UserFeedback = feedback.MessageText,
            };

            // Creates a consent agreement if the consent checkbox was selected
            if (feedback.ConsentIsAgreed)
            {
                // Gets the current contact
                var contact = contactTrackingService.GetCurrentContactAsync(User.Identity.Name).Result;

                // Creates an agreement for the specified consent and contact
                var agreement = formConsentAgreementService.Agree(contact, consent, item);

                // Adds the GUID of the agreement into the form's consent field
                item.ConsentAgreement = agreement.ConsentAgreementGuid;
            }

            // Inserts the form data into the database
            item.Insert();
        }
        /// <summary>
        /// Basic action that displays the feedback form.
        /// </summary>
        public ActionResult Fill()
        {
            var model = new FeedbackFormMessageConsentModel
            {
                // Adds the consent text to the form model
                ConsentShortText = consent.GetConsentText("en-US").ShortText,
                ConsentIsAgreed  = false
            };

            return(View("FormFillConsent", model));
        }
        public ActionResult SendFeedback(FeedbackFormMessageConsentModel model)
        {
            // Validates the received form data based on the view model
            if (!ModelState.IsValid)
            {
                model.ConsentShortText = consent.GetConsentText("en-US").ShortText;

                return(View("FormFillConsent", model));
            }

            // Inserts the collected form data to the connected database
            InsertFeedbackFormItem(model);

            return(View("FormSendSuccessConsent"));
        }