Beispiel #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;
 }
Beispiel #2
0
        public ActionResult CreateComment(QuizCommentModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            _quizService.CreateComment(model.QuizId, model.Comment);
            return(RedirectToAction("List"));
        }
Beispiel #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));
        }