Пример #1
0
 public static Expression<Func<Post, bool>> WhereFeedEquals( Feed feed )
 {
     return x => x.FeedId == feed.FeedId;
 }
Пример #2
0
 public static Expression<Func<Location, bool>> WhereFeedEquals(Feed feed)
 {
     return x => x.Name == feed.DefaultLocation;
 }
Пример #3
0
 public static Expression<Func<Feed, bool>> WhereNotEquals( Feed feed )
 {
     return x => x.FeedId != feed.FeedId;
 }
Пример #4
0
 public static Expression<Func<Feed, bool>> WhereEquals( Feed feed )
 {
     return x => x.Url == feed.Url;
 }
        private void SavePostsToDatabase( Feed feed, SyndicationFeed feedOutput )
        {
            var postService = ServiceLocator.Current.GetInstance<IPostService>();

            foreach (var item in feedOutput.Items)
            {
                if ( ((IDataService<Post>)postService).IsDuplicate( Post.WhereUrlEquals( item.Links[0].Uri.ToString() ) ) ) 
                    continue;

                var post = new Post();
                //post.Guid = item.Id;
                post.Url = item.Links[0].Uri.ToString();
                post.Title = item.Title.Text;
                post.Body = item.Summary.Text;
                post.PublishDateTime = item.PublishDate.LocalDateTime;
                post.LastUpdatedDateTime = item.LastUpdatedTime.LocalDateTime;
                post.Display = false;
                post.UserId = User.Anonymous.UserId;
                post.FeedId = feed.FeedId;
                post.LastUpdatedDateTime = DateTime.Now;
                post.PostCategoryId = postService.ExtractPostCategoryId( post );

                if ( PostCategoryId.Wanted.Is( post.PostCategoryId ) || PostCategoryId.Offered.Is( post.PostCategoryId ) )
                {
                    postService.Import( post );
                }

                
                
            }
        }