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); } }
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); } }