Beispiel #1
0
 public IList<FeedObj> GetForProject(int projectId)
 {
     var filter = new FeedFilter()
     {
         ProjectId = projectId
     };
     return Repository.GetFeeds(filter);
 }
Beispiel #2
0
        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();
            }
        }