public string EditQuestion(DTO.Question DtoQuestion) { DAO.Question _DaoQuestion = m_QuestionManagement.GetQuestion(DtoQuestion.Id); _DaoQuestion.Text = DtoQuestion.Text; m_QuestionManagement.SaveQuestion(_DaoQuestion); return(string.Empty); }
public string CreateQuestion(DTO.Question DtoQuestion) { DAO.Question _DaoQuestion = new DAO.Question() { Text = DtoQuestion.Text }; m_QuestionManagement.CreateQuestion(_DaoQuestion); 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); }