public JsonResult SaveReply(string value, int topicId = 0, int replyId = 0) { Reply reply; if (replyId == 0) { reply = new Reply(); reply.TopicId = topicId; reply.UserId = CurrentUser.UserId; reply.ReplyContent = value; reply.ReplyTime = DateTime.Now; _bbsService.AddTopicReply(reply); #region 积分 BusinessCommon.Integration.IntegrationManager.Instence.FireIntegrationEvent(IntegrationEvents.TopicReply, CurrentUser.UserId, CurrentTenant.TenantId); #endregion } else { reply = _bbsService.GetReplyById(replyId); reply.ReplyContent = value; _bbsService.EditTopicReply(reply); } return(Json(new { result = 1 }, JsonRequestBehavior.AllowGet)); }
public JsonResult DeleteReply(int replyId) { var reply = _bbsService.GetReplyById(replyId); if (reply == null) { return(Json(new { result = 0, msg = "没有找到要删除的回复" }, JsonRequestBehavior.AllowGet)); } var topic = _bbsService.GetTopicById(reply.TopicId); if (topic == null) { return(Json(new { result = 0, msg = "删除失败" }, JsonRequestBehavior.AllowGet)); } if (reply.UserId != CurrentUser.UserId) { return(Json(new { result = 0, msg = "不能删除他人的回复" }, JsonRequestBehavior.AllowGet)); } reply.IsDelete = 1; _bbsService.EditTopicReply(reply); return(Json(new { result = 1 }, JsonRequestBehavior.AllowGet)); }