public static CommentAttachment Create(Comment comment, ulong action_id) { CommentAttachment attachment = null; if (!string.IsNullOrEmpty(comment.attachment_type)) { ActivityAttachment attach = new ActivityAttachment() { id = (uint)comment.attachment_id, type = comment.attachment_type, mode = true }; //var attach = ActivityAttachments.GetByTypeAndId((comment.attachment_type,(uint)comment.attachment_id)).FirstOrDefault(); var feedAttachment = FeedAttachmentFactory.Create(attach, action_id); attachment = new CommentAttachment(feedAttachment); } return(attachment); }
private FeedAttachment[] GetAttachments(Activity activity, ulong forSource, string sourceType) { if (activity.RawActivity.Attachments == null) { return(null); } var feedAttachments = new List <FeedAttachment>(); //if it's a like/hare or comment, then the attachment is the subject feed if (activity.ObjectType == "activity_action") { feedAttachments.Add(new FeedAttachmentActivity(activity.InnerActivity, activity.RawActivity.object_id, forSource, sourceType, _isIOS)); } else { foreach (var att in activity.RawActivity.Attachments) { var attach = FeedAttachmentFactory.Create(att, activity.ActivityId); if (attach != null) { feedAttachments.Add(attach); } } } if (feedAttachments.Count > 0) { return(feedAttachments.ToArray()); } else { return(null); } }