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

            try
            {
                CheckModelState();
                var cate = _articleCategoryService.Get(a => a.RefNo == input.RefNo);
                json.Result = new ListInfo()
                {
                };
                if (cate != null)
                {
                    var articleCategoryIds = _articleCategoryService.ChildStateInts(cate.ID);
                    var outputList         = _articleService.GetTopSlideList(input.Top, articleCategoryIds);
                    json.Result = new ListInfo()
                    {
                        List = outputList
                    };
                }
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/article/slidelistbyrefno", LocalizationConst.QueryFail);
            }
            return(json);
        }
        public ResponseInfoModel ListByRefNo(string RefNo)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                var parent = _articleCategoryService.Get(a => a.RefNo == RefNo && a.State == 0);

                if (parent == null)
                {
                    json.Result = new ListInfo()
                    {
                        List = new object[] { }
                    };
                    return(json);
                }
                else
                {
                    int cateID     = parent.ID;
                    var outputList = _articleCategoryService.FrontlistByParent(cateID);
                    json.Result = new ListInfo()
                    {
                        List = outputList
                    };
                }
            }
            catch (Exception e)
            {
                DisposeUserFriendlyException(e, ref json, "api/category/listbyrefno", LocalizationConst.QueryFail);
            }
            return(json);
        }