コード例 #1
0
        public void DeleteComment(int id)
        {
            // Find comment with the matching id
            Comment comment = context.Comment.First(comment => comment.CommentID == id);

            // Remove from context and save changes
            context.Remove(comment);
            context.SaveChanges();
        }
コード例 #2
0
        public void DeleteStory(int id)
        {
            // Find the story with a matching id
            Story story = context.Story.First(story => story.StoryID == id);

            // Remove story from context and save changes
            context.Remove(story);
            context.SaveChanges();
        }