示例#1
0
        public ResponseInfoModel List([FromUri] GetArticleListInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();
                int pageSize           = _systemConfigurationService.GetPageSize();
                int limit              = pageSize;
                int offset             = pageSize * (input.PageIndex - 1);
                int total              = 0;
                var articleCategoryIds = _articleCategoryService.ChildInts(input.ArticleCategorysID);
                var outputList         = _articleService.GetArticleList(limit, offset, out total, input, articleCategoryIds);
                json.Result = new PagingInfo()
                {
                    totalCount = total, pageCount = (int)Math.Ceiling((decimal)total / pageSize), pageSize = pageSize, list = outputList
                };
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/article/list", LocalizationConst.QueryFail);
            }
            return(json);
        }