示例#1
0
        private IEnumerable <SubscriptionFeed> ConvertToSubscription()
        {
            feedRepository         = new FeedRepository(new FeedContext());
            subscriptionRepository = new SubscriptionRepository(new FeedContext());

            var feeds           = feedRepository.All();
            var subscribedFeeds = subscriptionRepository.All().ToList();

            foreach (FeedEntity feed in feeds)
            {
                var a = subscribedFeeds.Any(x => x.feedId == feed.Id && x.IsActive == true);

                yield return(new SubscriptionFeed()
                {
                    Id = feed.Id,
                    description = feed.description,
                    IsActive = feed.IsActive,
                    source = feed.source,
                    title = feed.title,
                    url = feed.url,
                    isSubscribed = subscribedFeeds.Any(x => x.feedId == feed.Id && x.IsActive == true)
                });
            }
            ;
        }