Ejemplo n.º 1
0
 public ActionResult Reply(int parentId, string text)
 {
     var result = _commentService.CreateComment(text, UserId ?? 0, null, parentId);
     var commentModel = new CommentViewModel();
     var comment = _commentService.GetComment(result.CommentId);
     if (comment != null)
     {
         commentModel = AutoMapper.Mapper.Map<CommentViewModel>(comment);
     }
     var html = this.RenderPartialViewToString("ReplySection", commentModel);
     return Json(new { result = comment != null, html });
 }
Ejemplo n.º 2
0
 public ActionResult CreateComment(string detail, int productId)
 {
     var result = _commentService.CreateComment(detail, UserId ?? 0, productId, null);
     var commentModel = new CommentViewModel();
     var comment = _commentService.GetComment(result.CommentId);
     if (comment != null)
     {
         commentModel = AutoMapper.Mapper.Map<CommentViewModel>(comment);
     }
     var commentCount = _commentService.GetCommentCountByProduct(productId);
     ViewBag.UserId = UserId;
     var html = this.RenderPartialViewToString("CommentBlock", commentModel);
     return Json(new { result = comment != null, commentCount, html });
 }