public static bool UpdateCommentNode(int commentId, string type, Dictionary <string, string> commentnode) { bool result = false; string filename = HttpContext.Current.Request.MapPath(HiContext.Current.GetPCHomePageSkinPath() + "/config/Comments.xml"); XmlDocument commentDocument = TagsHelper.GetCommentDocument(); XmlNode xmlNode = TagsHelper.FindCommentNode(commentId, type); if (xmlNode != null) { foreach (KeyValuePair <string, string> item in commentnode) { xmlNode.Attributes[item.Key].Value = item.Value; } commentDocument.Save(filename); new AspNetCache().Remove("CommentFileCache-Admin"); result = true; } return(result); }
public static XmlNode FindCommentNode(int id, string type) { XmlDocument commentDocument = TagsHelper.GetCommentDocument(); return(commentDocument.SelectSingleNode($"//Comment[@Id='{id}' and @Type='{type}']")); }