public IList<FeedObj> GetForProject(int projectId) { var filter = new FeedFilter() { ProjectId = projectId }; return Repository.GetFeeds(filter); }
public FeedObj Get(int id) { var filter = new FeedFilter { Id = id }; var obj = Repository.GetFeeds(filter).SingleOrDefault(); return obj; }
public IList<FeedObj> GetFeeds(FeedFilter filter) { using (var db = GetInnerTrackContext()) { var items = db.Feeds.AsQueryable(); if (filter.Id.HasValue) { items = items.Where(i => i.Id == filter.Id.Value); } if (filter.ProjectId.HasValue) { items = items.Where(i => i.Projects.Any(p => p.Id == filter.ProjectId.Value)); } return items.ToList(); } }