Esempio n. 1
0
        public void AddFeed(Feed feed)
        {
            feed.ThrowIfNull();

            db.Feeds.Add(feed);
            db.SaveChanges();

            if (FeedAdded != null)
            {
                FeedAdded(this, new FeedAddedEventArgs(feed));
            }
        }
Esempio n. 2
0
        public void DeleteFeed(Feed feed)
        {
            feed.ThrowIfNull();

            // Feed deletion handlers need relationships to FeedItem entities to be intact, so fire
            // event before db deletion.
            if (FeedDeleted != null)
            {
                FeedDeleted(this, new FeedDeletedEventArgs(feed));
            }

            db.Feeds.Remove(feed);
            db.SaveChanges();
        }
Esempio n. 3
0
 public FeedDeletedEventArgs(Feed deletedFeed)
 {
     DeletedFeed = deletedFeed.ThrowIfNull();
 }
Esempio n. 4
0
 public FeedAddedEventArgs(Feed addedFeed)
 {
     AddedFeed = addedFeed.ThrowIfNull();
 }
Esempio n. 5
0
 public FeedModifiedEventArgs(Feed modifiedFeed)
 {
     ModifiedFeed = modifiedFeed.ThrowIfNull();
 }
Esempio n. 6
0
        public void ModifyFeed(Feed feed)
        {
            feed.ThrowIfNull();
            if (db.GetEntityState(feed) != EntityState.Modified) return;

            db.SaveChanges();

            if (FeedModified != null)
            {
                FeedModified(this, new FeedModifiedEventArgs(feed));
            }
        }
Esempio n. 7
0
        public bool FeedExists(Feed feed)
        {
            feed.ThrowIfNull();

            return db.Feeds.Any(f => f.ID == feed.ID);
        }