Example #1
0
        private Folder AddFolder(Manager.Folder rssFolder)
        {
            var folder = _context.Folders.FirstOrDefault(f => f.Name == rssFolder.Name);

            if (folder != null)
                return folder;

            folder = _context.Folders.Create();

            folder.Name = rssFolder.Name;
            folder.Id = Guid.NewGuid();

            _context.Folders.Add(folder);

            return folder;
        }
Example #2
0
        private void AddFeed(Folder folder, Manager.Feed feed)
        {
            var feedId = Guid.NewGuid();
            var feedUrl = feed.FeedUri.ToString();

            //feed.Load();

            // if feed exists then skip it
            if (_context.Feeds.FirstOrDefault(f => f.FeedUrl == feedUrl) != null)
                return;

            folder.Feeds.Add(new Feed
                {
                    Id = feedId,
                    //FolderId = folderId,
                    Name = feed.Title,
                    FeedUrl = feed.FeedUri.ToString(),
                    HtmlUrl = feed.HtmlUri.ToString()
                    //Items = new Collection<Item>(feed.Items.Select(i => new Item
                    //    {
                    //        Id= Guid.NewGuid(),
                    //        Name = i.Title,
                    //        Raw = i.Content,
                    //        Content = i.Content,
                    //        FeedId = feedId,
                    //        PublishedDateTime = DateTime.Now //i.PublishedDateTime,
                    //    }).ToList())
                });
        }