public long AddComment(IComment comment) { if (!string.IsNullOrEmpty(comment.CommentText)) { var review = new comments { text = comment.CommentText, entity_id = comment.MaterialId, parent_id = comment.ParentId, proto_name = comment.ProtoName, account_id = comment.AuthorId, create_date = DateTime.Now }; Insert(review); UpdateNestedSets(review.entity_id, review.proto_name, review.parent_id, review.level, review.left_key); return review.id; } return 0; }
public comments RemoveComments(comments _item, bool _complete = false) { u_comments.Remove(_item); if(_complete) Meridian.Default.commentsStore.Delete(_item); return _item; }
public comments AddComments(comments _item, bool _insertToStore = false) { if(u_comments.IndexOf(_item) != -1) return _item; u_comments.Add(_item); _item.account_id = id; if(_insertToStore && !Meridian.Default.commentsStore.Exists(_item.id)) { Meridian.Default.commentsStore.Insert(_item); _item.LoadAggregations(Meridian.Default); } return _item; }