public string RemoveAnswerFromQuestion(DTO.QuestionAnswers QuestionAnswer) { DAO.QuestionAnswers _QuestionAnswer = m_QuestionManagement.GetAnswer(QuestionAnswer.QuestionId, QuestionAnswer.AnswerId); m_QuestionManagement.RemoveAnswer(_QuestionAnswer); return(string.Empty); }
public string AddAnswerToQuestion(DTO.QuestionAnswers QuestionAnswer) { DAO.Question _Question = m_QuestionManagement.GetQuestion(QuestionAnswer.QuestionId); DAO.Answer _Answer = m_AnswerManagement.GetAnswer(QuestionAnswer.AnswerId); m_QuestionManagement.AddAnswer(_Question, _Answer); return(string.Empty); }
public string SetCorrectAnswer(DTO.QuestionAnswers CorrectAnswer) { DAO.Question _Question = m_QuestionManagement.GetQuestion(CorrectAnswer.QuestionId); DAO.Answer _Answer = m_AnswerManagement.GetAnswer(CorrectAnswer.AnswerId); m_QuestionManagement.SetCorrectAnswer(_Question, _Answer); return(string.Empty); }
public string GetAllQuestions(string FilterName) { // Получить список вопросов. var _DaoQuestions = m_QuestionManagement.GetAllQuestions(string.Empty); // Получить список ответов на вопросы. List <DTO.Question> _DtoQuestions = new List <DTO.Question>(); foreach (var _DaoQuestion in _DaoQuestions) { // Вопрос. var _DtoQuestion = new DTO.Question() { Id = _DaoQuestion.Id, Text = _DaoQuestion.Text }; // Ответы. foreach (var _DaoAnswers in _DaoQuestion.Answers) { DTO.QuestionAnswers _DtoAnswer = new DTO.QuestionAnswers() { QuestionId = _DaoAnswers.QuestionId, AnswerId = _DaoAnswers.Answer.Id, AnswerText = _DaoAnswers.Answer.Text, IsCorrect = _DaoAnswers.IsCorrect }; _DtoQuestion.Answers.Add(_DtoAnswer); } _DtoQuestions.Add(_DtoQuestion); } string _Json = Utils.JsonSerialize(_DtoQuestions); return(_Json); }