Exemplo n.º 1
0
 public void SaveQuiz(Quiz quiz)
 {
     using (var ctx = new QuizBuilderEntities())
     {
         ctx.AddToQuizzes(quiz);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void UpdateQuiz(Quiz quiz)
 {
     using (var ctx = new QuizBuilderEntities())
     {
         ctx.Attach(quiz);
         var stateEntry = ctx.ObjectStateManager.GetObjectStateEntry(quiz);
         foreach (var propertyName in stateEntry.CurrentValues
                              .DataRecordInfo.FieldMetadata
                              .Select(fm => fm.FieldType.Name))
         {
             stateEntry.SetModifiedProperty(propertyName);
         }
         ctx.SaveChanges();
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Quizzes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToQuizzes(Quiz quiz)
 {
     base.AddObject("Quizzes", quiz);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Create a new Quiz object.
 /// </summary>
 /// <param name="quizID">Initial value of the QuizID property.</param>
 /// <param name="quizName">Initial value of the QuizName property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 public static Quiz CreateQuiz(global::System.Int32 quizID, global::System.String quizName, global::System.String title, global::System.String description)
 {
     Quiz quiz = new Quiz();
     quiz.QuizID = quizID;
     quiz.QuizName = quizName;
     quiz.Title = title;
     quiz.Description = description;
     return quiz;
 }