Beispiel #1
0
 public bool UpdateTestQuestion(TestQuestionModelDto model)
 {
     try
     {
         var question = TestQuestionModelDto.UnMap(model);
         new Repository <TestQuestionModel>().Update(question);
         return(true);
     }
     catch (Exception ex)
     {
         Logger.Error("Error : GetTestQuestion - {0}", ex.Message);
         return(false);
     }
 }
Beispiel #2
0
        public int AddQuestion(int id, TestQuestionModelDto question)
        {
            try
            {
                var questionId      = -1;
                var unmapedQuestion = TestQuestionModelDto.UnMap(question);
                DataAccess.InTransaction(session =>
                {
                    var test   = session.Get <TestModel>(id);
                    questionId = (int)session.Save(unmapedQuestion);
                    test.Questions.Add(unmapedQuestion);
                    session.Save(test);
                });

                return(questionId);
            }
            catch (Exception ex)
            {
                Logger.Error("Error : TestService.AddQuestion - {0}", ex.Message, ex.Data);
                return(-1);
            }
        }