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"); })); }
public async Task <IActionResult> Update(Guid Id) { var data = await ApiMessage.WrapData(async() => { return(await bannersBusienss.GetOne(Id)); }); return(View(data)); }
/// <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); })); }
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; })); }
/// <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() }; })); }
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(); })); } }
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(); })); } }
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; })); }
/// <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; })); }
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); })); }
public async Task <bool> Update(OrderEntity orderEntity) { return(await ApiMessage.WrapData(async() => await DataOrderAccessor.Update(orderEntity))); }
public async Task <OrderEntity> GetDetailData(Expression <Func <OrderEntity, bool> > expression, params string[] IncludeProperty) { return(await ApiMessage.WrapData(async() => await DataOrderAccessor.OneAsync(expression, IncludeProperty))); }
public async Task <OrderEntity> GetDetailData(Expression <Func <OrderEntity, bool> > expression) { return(await ApiMessage.WrapData(async() => await GetDetailData(expression, "OrderGoods", "OrderGoods.Good", "UserAccountEntry"))); }
public async Task <OrderEntity> GetDetailData(Guid orderId) { return(await ApiMessage.WrapData(async() => await GetDetailData(x => x.Id == orderId, "OrderGoods", "OrderGoods.Good", "UserAccountEntry"))); }