public static Expression<Func<Post, bool>> WhereFeedEquals( Feed feed ) { return x => x.FeedId == feed.FeedId; }
public static Expression<Func<Location, bool>> WhereFeedEquals(Feed feed) { return x => x.Name == feed.DefaultLocation; }
public static Expression<Func<Feed, bool>> WhereNotEquals( Feed feed ) { return x => x.FeedId != feed.FeedId; }
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 ); } } }