public void UpdateQuestionResponse(QuestionResponse questionResponse)
 {
     using (var ctx = new QuizBuilderEntities())
     {
         ctx.Attach(questionResponse);
         var stateEntry = ctx.ObjectStateManager.GetObjectStateEntry(questionResponse);
         foreach (var propertyName in stateEntry.CurrentValues
                              .DataRecordInfo.FieldMetadata
                              .Select(fm => fm.FieldType.Name))
         {
             stateEntry.SetModifiedProperty(propertyName);
         }
         ctx.SaveChanges();
     }
 }
 /// <summary>
 /// Create a new QuestionResponse object.
 /// </summary>
 /// <param name="questionResponseID">Initial value of the QuestionResponseID property.</param>
 /// <param name="quizAttemptID">Initial value of the QuizAttemptID property.</param>
 /// <param name="questionID">Initial value of the QuestionID property.</param>
 /// <param name="isCorrect">Initial value of the IsCorrect property.</param>
 /// <param name="userReviewFlag">Initial value of the UserReviewFlag property.</param>
 public static QuestionResponse CreateQuestionResponse(global::System.Int32 questionResponseID, global::System.Int32 quizAttemptID, global::System.Int32 questionID, global::System.Boolean isCorrect, global::System.Boolean userReviewFlag)
 {
     QuestionResponse questionResponse = new QuestionResponse();
     questionResponse.QuestionResponseID = questionResponseID;
     questionResponse.QuizAttemptID = quizAttemptID;
     questionResponse.QuestionID = questionID;
     questionResponse.IsCorrect = isCorrect;
     questionResponse.UserReviewFlag = userReviewFlag;
     return questionResponse;
 }
 public void SaveQuestionResponse(QuestionResponse questionResponse)
 {
     using (var ctx = new QuizBuilderEntities())
     {
         ctx.AddToQuestionResponses(questionResponse);
         ctx.SaveChanges();
     }
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the QuestionResponses EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToQuestionResponses(QuestionResponse questionResponse)
 {
     base.AddObject("QuestionResponses", questionResponse);
 }