public void UpdateQuestion(Question question)
 {
     using (var ctx = new QuizBuilderEntities())
     {
         ctx.Attach(question);
         var stateEntry = ctx.ObjectStateManager.GetObjectStateEntry(question);
         foreach (var propertyName in stateEntry.CurrentValues
                              .DataRecordInfo.FieldMetadata
                              .Select(fm => fm.FieldType.Name))
         {
             stateEntry.SetModifiedProperty(propertyName);
         }
         ctx.SaveChanges();
     }
 }
 /// <summary>
 /// Create a new Question object.
 /// </summary>
 /// <param name="questionID">Initial value of the QuestionID property.</param>
 /// <param name="scenarioID">Initial value of the ScenarioID property.</param>
 /// <param name="questionSequence">Initial value of the QuestionSequence property.</param>
 /// <param name="questionText">Initial value of the QuestionText property.</param>
 /// <param name="isRichText">Initial value of the isRichText property.</param>
 public static Question CreateQuestion(global::System.Int32 questionID, global::System.Int32 scenarioID, global::System.Int32 questionSequence, global::System.String questionText, global::System.Boolean isRichText)
 {
     Question question = new Question();
     question.QuestionID = questionID;
     question.ScenarioID = scenarioID;
     question.QuestionSequence = questionSequence;
     question.QuestionText = questionText;
     question.isRichText = isRichText;
     return question;
 }
 public void SaveQuestion(Question question)
 {
     using (var ctx = new QuizBuilderEntities())
     {
         ctx.AddToQuestions(question);
         ctx.SaveChanges();
     }
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Questions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToQuestions(Question question)
 {
     base.AddObject("Questions", question);
 }