public ExecuteResult AddComment(BlogCommentAddPageDTO dto, IUserBasicInfo userInfo) { ExecuteResult result = new ExecuteResult() { IsSuccess = true }; BlogCommentEntity commentEntity = Mapper.DynamicMap <BlogCommentEntity>(dto); commentEntity.InsertTime = DateTime.Now; commentEntity.UserID = userInfo.UserID; commentEntity.RealName = userInfo.RealName; MyTransaction transaction = this._commentDal.OpenTransaction(); try { this._commentDal.Add(commentEntity); this._blogDal.UpdateBlogComment(dto.BlogID, 1); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); throw ex; } return(result); }
public ActionResult AjaxAddComment(BlogCommentAddPageDTO dto) { var result = _blogCommentService.AddComment(dto, UserContext.CurrentUser); return(Json(result, JsonRequestBehavior.AllowGet)); }