private DataFeed GetFeeds(IVkDataProvider dataProvider, LikeShareType type, string entityVkId, VkGroup vkGroup, ref int offsetCounter) { var likesFeed = dataProvider.GetLikes(vkGroup.Id.ToString(), entityVkId, type, offsetCounter); if (likesFeed == null) { return(null); } this.log.DebugFormat("Like feed is received: {0}", likesFeed.Feed); likesFeed.ParentObjectId = entityVkId; likesFeed.LikeShareType = (int)type; string newFeed = this.responseMapper.MapResponseObject(likesFeed); var dataFeed = new DataFeed { ReceivedAt = this.dateTimeHelper.GetDateTimeNow(), Feed = newFeed, VkGroupId = vkGroup.Id, RelatedObjectId = entityVkId, Type = DataFeedType.MemberLikes }; if (likesFeed.users[0].uid == null || likesFeed.users[0].uid.Length == 0) { return(null); } offsetCounter += likesFeed.users.Length; return(dataFeed); }
public IEnumerable <DataFeed> GetFeeds(IVkDataProvider dataProvider, VkGroup vkGroup) { DateTime? dateLimit = this.strategy.GetDateLimit(vkGroup.Id, this.ProvidedDataType); IList <Video> videos = this.videoRepository.GetVideosByVkGroupId(vkGroup.Id).Where(v => !dateLimit.HasValue || v.PostedDate > dateLimit).ToList(); foreach (var video in videos) { var videoLikes = dataProvider.GetLikes(vkGroup.Id.ToString(), video.VkId, LikeShareType.Video, 0); if (videoLikes == null) { continue; } this.log.DebugFormat("Video comments feed is received: {0}", videoLikes.Feed); videoLikes.ParentObjectId = video.VkId; string newFeed = this.responseMapper.MapResponseObject(videoLikes); DataFeed dataFeed = new DataFeed { ReceivedAt = this.dateTimeHelper.GetDateTimeNow(), Feed = newFeed, VkGroupId = vkGroup.Id, RelatedObjectId = video.VkId, Type = DataFeedType.VideoLikes }; yield return(dataFeed); } }