Example #1
0
        public async Task <IActionResult> GetByTypeId(long postTypeId, int pageIndex = 1, int pageDataCount = 10, bool?IsKnot = null, bool?IsEssence = null)
        {
            var postType = await TypeSvc.GetByIdAsync(postTypeId);

            if (postType == null)
            {
                return(new JsonResult(
                           new APIResult <long>()
                {
                    ErrorMsg = "帖子类型不存在"
                }
                           )
                {
                    StatusCode = 400
                });
            }
            return(new JsonResult(
                       new APIResult <ListModel <ListPostDTO> >()
            {
                Data = new ListModel <ListPostDTO>
                {
                    Datas = await PostSvc.GetPageByTypeIdAsync(postTypeId, pageIndex, pageDataCount, IsKnot, IsEssence),
                    TotalCount = await PostSvc.GetByPostTypeIdCountAsync(postTypeId, IsKnot, IsEssence)
                }
            }
                       ));
        }