/// <summary>
 /// Create a new vwQuestionAnswer object.
 /// </summary>
 /// <param name="userProfileQuestionId">Initial value of the UserProfileQuestionId property.</param>
 /// <param name="question">Initial value of the Question property.</param>
 /// <param name="order">Initial value of the Order property.</param>
 /// <param name="created">Initial value of the Created property.</param>
 /// <param name="active">Initial value of the Active property.</param>
 public static vwQuestionAnswer CreatevwQuestionAnswer(global::System.Int32 userProfileQuestionId, global::System.String question, global::System.Byte order, global::System.DateTime created, global::System.Boolean active)
 {
     vwQuestionAnswer vwQuestionAnswer = new vwQuestionAnswer();
     vwQuestionAnswer.UserProfileQuestionId = userProfileQuestionId;
     vwQuestionAnswer.Question = question;
     vwQuestionAnswer.Order = order;
     vwQuestionAnswer.Created = created;
     vwQuestionAnswer.Active = active;
     return vwQuestionAnswer;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the vwQuestionAnswers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTovwQuestionAnswers(vwQuestionAnswer vwQuestionAnswer)
 {
     base.AddObject("vwQuestionAnswers", vwQuestionAnswer);
 }
        public JsonResult SaveUserProfileQuestions(String QuestionAnswerList, String SessionId)
        {
            try
            {
                Guid SessionIdGuid = new Guid(SessionId);
                DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(List<QuestionAnswer>));
                System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(System.Text.Encoding.ASCII.GetBytes(QuestionAnswerList));
                List<QuestionAnswer> questionList = (List<QuestionAnswer>)serializer.ReadObject(memoryStream);

                List<vwQuestionAnswer> submitQA = new List<vwQuestionAnswer>();
                foreach (QuestionAnswer qa in questionList)
                {
                    vwQuestionAnswer newQA = new vwQuestionAnswer();
                    newQA.Answer = qa.Answer;
                    newQA.UserProfileQuestionId = qa.UserProfileQuestionId;
                    newQA.UserProfileAnswerId = qa.UserProfileAnswerId;
                    submitQA.Add(newQA);
                }

                JsonResult result = Json(UserProfileQuestionsResults.SaveUserQuestions(submitQA, SessionIdGuid), JsonRequestBehavior.AllowGet);
                return result;
                //return Json("Success", JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                return Json(ex.Message, JsonRequestBehavior.AllowGet);
            }
            //return Json(QuestionAnswerList, JsonRequestBehavior.AllowGet);
        }