Esempio n. 1
0
 /// <summary>
 /// Removes a test
 /// </summary>
 /// <param name="test">The test to remove</param>
 public void RemoveTest(Test test)
 {
     using (MultipleChoiceEntities multipleChoiceEntities = new MultipleChoiceEntities())
     {
         multipleChoiceEntities.Tests.Remove(test);
         multipleChoiceEntities.SaveChanges();
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Adds a new test
 /// </summary>
 /// <param name="test">The test to add</param>
 public static void AddTest(Test test)
 {
     using (MultipleChoiceEntities multipleChoiceEntities = new MultipleChoiceEntities())
     {
         multipleChoiceEntities.Tests.Add(test);
         multipleChoiceEntities.SaveChanges();
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Removes a question
 /// </summary>
 /// <param name="question">The question to remove</param>
 public void RemoveQuestion(Question question)
 {
     using (MultipleChoiceEntities multipleChoiceEntities = new MultipleChoiceEntities())
     {
         multipleChoiceEntities.Questions.Remove(question);
         multipleChoiceEntities.SaveChanges();
     }
 }
 /// <summary>
 /// Sets the user's password
 /// </summary>
 /// <param name="ID">The ID of the user</param>
 /// <param name="value">The value to assign to the password</param>
 public static void SetPassword(int ID, string value)
 {
     using (MultipleChoiceEntities multipleChoiceEntities = new MultipleChoiceEntities())
     {
         multipleChoiceEntities.Users.FirstOrDefault(x => x.User_ID == ID)
         .Password = value;
         multipleChoiceEntities.SaveChanges();
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Removes a question
 /// </summary>
 /// <param name="question">The question to remove</param>
 public static void RemoveQuestion(int questionID)
 {
     using (MultipleChoiceEntities multipleChoiceEntities = new MultipleChoiceEntities())
     {
         Question entity = multipleChoiceEntities.Questions.FirstOrDefault(x => x.Question_ID == questionID);
         multipleChoiceEntities.Questions.Remove(entity);
         multipleChoiceEntities.SaveChanges();
     }
 }
Esempio n. 6
0
 /// <summary>
 /// Adds a new question to a test
 /// </summary>
 /// <param name="question">The question to add to the test</param>
 /// <param name="testID">The ID of the test</param>
 public static void AddQuestion(Question question, int testID)
 {
     using (MultipleChoiceEntities multipleChoiceEntities = new MultipleChoiceEntities())
     {
         question.Test_ID = testID;
         multipleChoiceEntities.Questions.Add(question);
         multipleChoiceEntities.SaveChanges();
     }
 }
Esempio n. 7
0
 /// <summary>
 /// Sets choice B to the value specified
 /// </summary>
 /// <param name="questionID">The ID of the question</param>
 /// <param name="testID">The ID of the test</param>
 /// <param name="value">The value to assign</param>
 public static void SetChoiceB(int questionID, int testID, string value)
 {
     using (MultipleChoiceEntities multipleChoiceEntities = new MultipleChoiceEntities())
     {
         multipleChoiceEntities.Questions
         .FirstOrDefault(x => x.Question_ID == questionID && x.Test_ID == testID)
         .ChoiceB = value;
         multipleChoiceEntities.SaveChanges();
     }
 }
Esempio n. 8
0
 /// <summary>
 /// Sets the name of the test to the value
 /// </summary>
 /// <param name="testID">The ID of the test</param>
 /// <param name="value">The value to assign to the test</param>
 public static void SetTestName(int testID, string value)
 {
     using (MultipleChoiceEntities multipleChoiceEntities = new MultipleChoiceEntities())
     {
         multipleChoiceEntities.Tests
         .FirstOrDefault(x => x.Test_ID == testID)
         .Name = value;
         multipleChoiceEntities.SaveChanges();
     }
 }