Beispiel #1
0
        protected override void RemoveRecordFromTable(object refRecord)
        {
            Comment comment = refRecord as Comment;

            Comments.Remove(comment.comment_id);
            if (!string.IsNullOrEmpty(comment.attachment_type) && comment.attachment_id != 0)
            {
                uint fileId = 0;
                //remove attachment
                if (comment.attachment_type == "album_photo")
                {
                    var photo = AlbumPhotos.GetById((uint)comment.attachment_id);
                    fileId = photo.file_id;
                }

                if (fileId != 0)
                {
                    Logger.Instance.Debug($"Removing storage file {fileId}");
                    Storages.DeleteByFileId(fileId);
                }
            }
        }