コード例 #1
0
        public async Task DeleteForum(string forumId)
        {
            var posts = forumDbContext.Posts.Where(p => p.ForumId == forumId);

            forumDbContext.RemoveRange(posts);

            var threads = forumDbContext.Threads.Where(t => t.ForumId == forumId);

            forumDbContext.RemoveRange(threads);

            var forum = forumDbContext.Forums.Where(f => f.ForumId == forumId);

            forumDbContext.RemoveRange(forum);

            await forumDbContext.SaveChangesAsync();
        }