// PUBLIC // ============================================================================================= public TestQuestionDTO UpsertQuestion(TestQuestionDTO questionReceived) { var id = questionReceived.id; test_question question; if (id == 0) { question = new test_question(); TestQuestionMapper.CopyValues(questionReceived, question); _questionRepository.Add(question); } else { question = _questionRepository.Get(id); _questionRepository.SetNewValues(questionReceived, question); } return(TestQuestionMapper.GetDTO(question)); }
public IEnumerable <TestQuestionDto> GetQuestionsByTestId(int testId) { IEnumerable <TestQuestion> testQuestions = testQuestionRepository.Get(filter: q => q.TestId == testId); return(mapper.Map <IEnumerable <TestQuestionDto> >(testQuestions)); }