예제 #1
0
        public Test(DBWrapper.Entities.Test test)
        {
            Id         = test.TestId;
            Complexity = test.Complexity;
            Text       = test.Text;
            Answer     = test.Answer;

            if (test.TestSet != null)
            {
                TestSet = new TestSet
                              (test.TestSet.TestSetId, test.TestSet.Complexity, test.TestSet.Name);
            }

            FakeAnswers = new List <string>();

            if (test.FakeAnswers == null)
            {
                return;
            }
            var fakeAnswers = test.FakeAnswers.Split(';');

            foreach (var fakeAnswer in fakeAnswers)
            {
                FakeAnswers.Add(fakeAnswer);
            }
        }
예제 #2
0
 public string AddTest(Test test)
 {
     try
     {
         var newTest = new DBWrapper.Entities.Test
         {
             Answer      = test.Answer, Complexity = test.Complexity, Text = test.Text,
             FakeAnswers = ConvertFakeAnswersToString(test.FakeAnswers)
         };
         _dbWrapper.AddTest(newTest);
         return(null);
     }
     catch (Exception e)
     {
         return(e.ToString());
     }
 }