Ejemplo n.º 1
0
        public AnswerDetailVM EditAnswer(int questionId, int answerId, string answerText, int sortOrder, bool isCorrect)
        {
            var answer       = context.Answers.SingleOrDefault(o => o.Id == answerId);
            var questionType = context.Questions.SingleOrDefault(o => o.Id == questionId).QuestionType;

            answer.AnswerText = answerText;
            answer.IsCorrect  = isCorrect;
            answer.SortOrder  = sortOrder;

            var model = new AnswerDetailVM()
            {
                AnswerId     = answerId,
                AnswerText   = answerText,
                IsChecked    = isCorrect,
                QuestionType = questionType,
                SortOrder    = answer.SortOrder
            };

            context.SaveChanges();

            return(model);
        }
Ejemplo n.º 2
0
 public int CreateAnswer(int questionId, AnswerDetailVM viewModel)
 {
     throw new NotImplementedException();
 }