コード例 #1
0
 public async Task <ContentEntry> GetContentById(Guid Id, int skipCount = 0, int pageSize = 20)
 {
     return(await ApiMessage.WrapData(async() =>
     {
         return await ContentAccessor.OneAsync <ContentEntry>(x => x.Id == Id, "MediaResource", "Category", "Category.ContentList");
     }));
 }
コード例 #2
0
        public async Task <IActionResult> Update(Guid Id)
        {
            var data = await ApiMessage.WrapData(async() =>
            {
                return(await bannersBusienss.GetOne(Id));
            });

            return(View(data));
        }
コード例 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Id"></param>
 /// <param name="skipCount"></param>
 /// <param name="pageSize"></param>
 /// <returns>文章内容, 评论总数</returns>
 public async Task <Tuple <ContentEntry, int> > GetContentWityCommentById(Guid Id, int skipCount = 0, int pageSize = 20)
 {
     return(await ApiMessage.WrapData(async() =>
     {
         var contentEnry = await ContentAccessor.OneAsync <ContentEntry>(x => x.Id == Id, "MediaResource");
         var totalNum = await ContentAccessor.Count <Comment>(x => x.ContentEntryId == Id);
         return Tuple.Create(contentEnry, totalNum);
     }));
 }
コード例 #4
0
        public async Task <IList <UserRecentLogOutputViewModel> > GetContentUserReadLog(Guid userId, int skipCount, int pageSize)
        {
            return(await ApiMessage.WrapData(async() =>
            {
                var cateList = await CategoryAccessor.GroupCategories(x => x.UserId == userId && x.ContentEntry != null && x.ContentEntry.MediaResource.Count > 0, skipCount, pageSize);

                await ResetCategoryCoverImg(cateList);

                return cateList;
            }));
        }
コード例 #5
0
 /// <summary>
 /// 查询Category 带 详情内容, 评论内容
 /// </summary>
 /// <param name="Id"></param>
 /// <returns></returns>
 public async Task <CategoryOutput> GetCategoryWithDetailById(Guid Id)
 {
     return(await ApiMessage.WrapData(async() =>
     {
         var categoryInfo = await CategoryAccessor.OneAsync <Categories>(x => x.Status != ContentStatus.Close && x.Id == Id, "ChildrenCategories", "ChildrenCategories.ContentList", "ContentList", "ContentList.MediaResource");
         return new CategoryOutput
         {
             Category = categoryInfo,
             CategoryComments = (await CategoryAccessor.ListAsync <CategoryComment>(c => c.CategoryId == categoryInfo.Id, 0, 5)).ToList()
         };
     }));
 }
コード例 #6
0
 public async Task <string> GetPrevContentId(ContentEntry cEntry)
 {
     if (cEntry.Order == 0)
     {
         return(null);
     }
     else
     {
         return(await ApiMessage.WrapData(async() =>
         {
             var prevEntry = await ContentAccessor.OneAsync <ContentEntry>(x => x.Order == cEntry.Order - 1 && x.Category == cEntry.Category);
             return prevEntry.Id.ToString();
         }));
     }
 }
コード例 #7
0
        public async Task <string> GetNextContentId(ContentEntry cEntry)
        {
            var contentCountOfCategory = cEntry.Category.ContentList.Count;

            if (cEntry.Order + 1 == contentCountOfCategory)
            {
                return(null);
            }
            else
            {
                return(await ApiMessage.WrapData(async() =>
                {
                    var nextEntry = await ContentAccessor.OneAsync <ContentEntry>(x => x.Order == cEntry.Order + 1 && x.Category == cEntry.Category);
                    return nextEntry.Id.ToString();
                }));
            }
        }
コード例 #8
0
        public async Task <IList <Categories> > GetTopCategory(string queryKey, int skipCount = 0, int pageSize = 20)
        {
            return(await ApiMessage.WrapData(async() =>
            {
                IList <Categories> cateList;
                if (!string.IsNullOrEmpty(queryKey))
                {
                    cateList = await CategoryAccessor.ListOrderByDescendingAsync <Categories>(x => x.Status != ContentStatus.Close && x.ParentCategory.Name == "漫画" && x.Name.Contains(queryKey), skipCount, pageSize, "MediaResource");
                }
                else
                {
                    cateList = await CategoryAccessor.ListOrderByDescendingAsync <Categories>(x => x.Status != ContentStatus.Close && x.ParentCategory.Name == "漫画", skipCount, pageSize, "MediaResource");
                }

                await ResetCategoryCoverImg(cateList);

                return cateList;
            }));
        }
コード例 #9
0
        /// <summary>
        /// 阅读时写入用户阅读记录
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="userId"></param>
        /// <param name="skipCount"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public async Task <ContentEntry> GetContentByIdSetLog(Guid Id, string userId, int skipCount = 0, int pageSize = 20)
        {
            return(await ApiMessage.WrapData(async() =>
            {
                var contentEntry = await ContentAccessor.OneAsync <ContentEntry>(x => x.Id == Id, "MediaResource", "Category", "Category.ContentList");

                if (!string.IsNullOrEmpty(userId))
                {
                    await ContentAccessor.Add(new ContentUserReadLog
                    {
                        CreateTime = DateTime.Now,
                        Id = Guid.NewGuid(),
                        Categories = contentEntry.Category,
                        UserId = Guid.Parse(userId),
                        ContentEntry = contentEntry
                    });
                }
                return contentEntry;
            }));
        }
コード例 #10
0
        public async Task <Tuple <IList <Categories>, int> > GetTopSexHotWithTotalNum(int skipCount, int pageSize)
        {
            return(await ApiMessage.WrapData(async() =>
            {
                IList <Categories> cateList;
                int total = 0;
                cateList = await CategoryAccessor.ListOrderByDescendingAsync <Categories>(x => x.Status != ContentStatus.Close &&
                                                                                          x.ParentCategory.Name == "漫画" &&
                                                                                          (x.Tags.Any(c => c.Name == "顶通") ||
                                                                                           x.Tags.Any(c => c.Name == "恋爱"))
                                                                                          , skipCount, pageSize, "MediaResource");
                total = await CategoryAccessor.Count <Categories>(x => x.Status != ContentStatus.Close &&
                                                                  x.ParentCategory.Name == "漫画" &&
                                                                  (x.Tags.Any(c => c.Name == "顶通") ||
                                                                   x.Tags.Any(c => c.Name == "恋爱")));

                await ResetCategoryCoverImg(cateList);
                return Tuple.Create(cateList, total);
            }));
        }
コード例 #11
0
 public async Task <bool> Update(OrderEntity orderEntity)
 {
     return(await ApiMessage.WrapData(async() => await DataOrderAccessor.Update(orderEntity)));
 }
コード例 #12
0
 public async Task <OrderEntity> GetDetailData(Expression <Func <OrderEntity, bool> > expression, params string[] IncludeProperty)
 {
     return(await ApiMessage.WrapData(async() => await DataOrderAccessor.OneAsync(expression, IncludeProperty)));
 }
コード例 #13
0
 public async Task <OrderEntity> GetDetailData(Expression <Func <OrderEntity, bool> > expression)
 {
     return(await ApiMessage.WrapData(async() => await GetDetailData(expression, "OrderGoods", "OrderGoods.Good", "UserAccountEntry")));
 }
コード例 #14
0
 public async Task <OrderEntity> GetDetailData(Guid orderId)
 {
     return(await ApiMessage.WrapData(async() => await GetDetailData(x => x.Id == orderId, "OrderGoods", "OrderGoods.Good", "UserAccountEntry")));
 }