示例#1
0
 public static QuestionResponse AddResponse(QuestionResponse response)
 {
     using (QuizBuilderDb db = new QuizBuilderDb())
     {
         QuestionResponse toAdd = response;
         db.QuestionResponses.Add(toAdd);
         db.SaveChanges();
         return toAdd;
     }
 }
示例#2
0
 public static QuestionResponse UpdateResponse(QuestionResponse updatedResponse)
 {
     using (QuizBuilderDb db = new QuizBuilderDb())
     {
         QuestionResponse currentReponse = db.QuestionResponses.Find(updatedResponse.QuestionResponseID);
         if (currentReponse != null)
         {
             currentReponse.QuestionOptionID = updatedResponse.QuestionOptionID;
             currentReponse.QuestionID = updatedResponse.QuestionID;
             currentReponse.IsCorrect = updatedResponse.IsCorrect;
             currentReponse.UserReviewFlag = updatedResponse.UserReviewFlag;
             currentReponse.QuizAttemptID = updatedResponse.QuizAttemptID;
             db.SaveChanges();
             return currentReponse;
         }
         else
         {
             return currentReponse;
         }
     }
 }