public ActionResult EditReply(int PostId, string content) { int id = PostId; var post = _db.Posts.Find(id); if (post == null) { return(NotFound()); } if (post.Author != User.Identity.Name && !User.IsInRole("Administrator") && !User.IsInRole("Moderator")) { return(Json(new { errmsg = "你tmd没权限更改" })); } else if (string.IsNullOrWhiteSpace(content)) { return(Json(new { errmsg = "回复不能为空" })); } if (User.Identity.Name != post.Author) { _adminUtil.log(User.Identity.Name, "editreply", _blogUtil.GetPostLink(post)); } var mention = new MentionHandler(_udb); post.Content = mention.ParseMentions(_sanitizerService.Sanitize(content)); if (mention.HasMentions()) { mention.SendMentionMsg(_msgUtil, User.Identity.Name, _blogUtil.GetPostTitle(post), _blogUtil.GetPostLink(post)); } _db.SaveChanges(); return(Json(true)); }