public ResponseInfoModel WildList([FromUri] GetObjFontListInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();
                int pageSize = input.PageSize;
                int limit    = pageSize;
                int offset   = pageSize * (input.PageIndex - 1);
                int total;
                var outputList = _wildlifeManagerService.GetList(limit, offset, out total, input.Keywords);
                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/wildlifemanager/wildlist", LocalizationConst.QueryFail);
            }
            return(json);
        }
Esempio n. 2
0
        public ResponseInfoModel RouteList([FromUri] GetObjFontListInput input)
        {
            ResponseInfoModel json = new ResponseInfoModel()
            {
                Success = 1, Result = new object()
            };

            try
            {
                CheckModelState();
                string keywords = (input.Keywords ?? "").Trim();
                int    pageSize = input.PageSize;
                int    limit    = pageSize;
                int    offset   = pageSize * (input.PageIndex - 1);
                int    total;
                var    outputList = _routeService.GetPageList(limit, offset, out total,
                                                              a => string.IsNullOrEmpty(keywords) || a.RouteName.Contains(keywords), true,
                                                              a => a.OrderID).Select(s => new { s.ID, s.RouteName, s.OrderID }).ToList();
                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/route/routelist", LocalizationConst.QueryFail);
            }
            return(json);
        }