Example #1
0
        public ActionResult GetList(PrinterSearchDTO req)
        {
            if (req.ListType == 1)
            {
                req.offset = (req.offset - 1) * req.limit;
            }

            var list = _printerRepository.GetList(req, out int total);

            return(Json(new { rows = list, total = total, code = 0, msg = "" }, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public List <PrinterDTO> GetList(PrinterSearchDTO req, out int total)
        {
            using (var db = new SqlSugarClient(Connection))
            {
                //string order = "Id desc";
                List <PrinterDTO> list = new List <PrinterDTO>();
                var models             = db.Queryable <Printer>().Where(p => p.IsDelete == false).ToList();
                list  = ConvertToInfoList(models);
                total = list.Count;

                return(list.Skip(req.offset).Take(req.limit).ToList());
            }
        }