コード例 #1
0
        /// <summary>
        /// 查询列表
        /// </summary>
        /// <param name="requestModel"></param>
        /// <returns></returns>
        public BusinessBaseViewModel <IList <QuerySystemSectionResponseModel> > Query(QuerySystemSectionRequestModel requestModel)
        {
            var res = new BusinessBaseViewModel <IList <QuerySystemSectionResponseModel> >()
            {
                Status = ResponseStatus.Fail
            };

            var filter = PredicateBuilder.True <SystemSection>();

            if (!requestModel.KeyWord.IsNullOrWhiteSpace())
            {
                filter = filter.And(x => x.Name.Contains(requestModel.KeyWord));
            }

            var order = new IOrderByBuilder <SystemSection>[]
            {
                new OrderByBuilder <SystemSection, int>(x => x.Sort, false),
            };

            var query = _systemSectionRepository.Find(filter, order);

            if (query.Any())
            {
                var list = query.MapToList <QuerySystemSectionResponseModel>();

                res.BusinessData = list;
            }

            res.Status = ResponseStatus.Success;
            return(res);
        }
コード例 #2
0
        /// <summary>
        /// 获取
        /// </summary>
        /// <param name="requestModel"></param>
        /// <returns></returns>
        public ActionResult Query(QuerySystemSectionRequestModel requestModel)
        {
            var res = _systemSectionService.Query(requestModel);

            return(Content(res.ToJsonString()));
        }