Esempio n. 1
0
        public async Task CreateMultiContent(Guid pid, string contentName, int count)
        {
            var category = await ContentAccessor.OneAsync <Categories>(x => x.Status != ContentStatus.Close && x.Id == pid);

            var contentList = new List <ContentEntry>();

            for (int i = 1; i <= count; i++)
            {
                contentList.Add(new ContentEntry
                {
                    Category   = category,
                    Title      = $"{contentName} 第{i}话",
                    Order      = i,
                    CreateTime = DateTime.Now,
                    Id         = Guid.NewGuid()
                });
            }
            await ContentAccessor.All <ContentEntry>().AddRangeAsync(contentList);

            await ContentAccessor.SaveAsync();
        }
Esempio n. 2
0
        public async Task CreateCategoryComment(CategoryComment comment)
        {
            await ContentAccessor.Add(comment);

            await ContentAccessor.SaveAsync();
        }