private void PrepareQuizCommentModel(QuizCommentModel model, QuizComment comment) { model.CommentId = comment.CommentId; model.CreatedUtc = comment.CreatedUtc; model.Comment = comment.Comment; model.QuizId = comment.QuizId; }
public ActionResult CreateComment(QuizCommentModel model) { if (!ModelState.IsValid) { return(View(model)); } _quizService.CreateComment(model.QuizId, model.Comment); return(RedirectToAction("List")); }
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)); }