public void DeleteCommentAttachment(int commentAttachmentId) { var rows = CommentsAttachments.Select(string.Format("CommentAttachmentID = {0}", commentAttachmentId)); if (!rows.Any()) { return; } var deletingCommentAttachment = rows.First(); deletingCommentAttachment.Delete(); UpdateCommentsAttachments(); }
public void AddCommentAttachment(int commentId, string commentAttachmentName) { var newCommentAttachment = CommentsAttachments.NewRow(); newCommentAttachment["CommentID"] = commentId; newCommentAttachment["CommentAttachmentName"] = commentAttachmentName; CommentsAttachments.Rows.Add(newCommentAttachment); UpdateCommentsAttachments(); var commentAttachmentId = GetCommentAttachmentId(commentId, commentAttachmentName); newCommentAttachment["CommentAttachmentID"] = commentAttachmentId; newCommentAttachment.AcceptChanges(); }
public void DeleteCommentAttachments(int commentId) { var rows = CommentsAttachments.Select(string.Format("CommentID = {0}", commentId)); if (!rows.Any()) { return; } foreach (var deletingCommentAttachment in rows) { deletingCommentAttachment.Delete(); } UpdateCommentsAttachments(); }