Exemplo n.º 1
0
 private void PrepareQuizCommentModel(QuizCommentModel model, QuizComment comment)
 {
     model.CommentId  = comment.CommentId;
     model.CreatedUtc = comment.CreatedUtc;
     model.Comment    = comment.Comment;
     model.QuizId     = comment.QuizId;
 }
Exemplo n.º 2
0
        public ActionResult CreateComment(QuizCommentModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            _quizService.CreateComment(model.QuizId, model.Comment);
            return(RedirectToAction("List"));
        }
Exemplo n.º 3
0
        public ActionResult Comment(int id)
        {
            var comments = _quizService.GetQuizCommentsByQuizId(id);
            var model    = new QuizCommentListModel
            {
                Comments = new List <QuizCommentModel>(),
                QuizId   = id
            };

            foreach (var comment in comments)
            {
                var quizComment = new QuizCommentModel();
                PrepareQuizCommentModel(quizComment, comment);
                model.Comments.Add(quizComment);
            }

            return(View(model));
        }