/// <summary> /// 查询所有商品 /// </summary> /// <param name="pageNum">第几页</param> /// <param name="pageSize">每页多少条数据</param> /// <returns></returns> // GET: api/<ShangpinController> [HttpGet] public async Task<ActionResult<IEnumerable<SHANGPIN>>> Get(int pageNum, int pageSize) { var goods = await _dataContext.Shangpin .AsNoTracking() .OrderBy(g => g.SPDM) .Skip((pageNum-1)*pageSize+1) .Take(pageNum*pageSize) .ToListAsync(); if (goods != null) { return new ObjectResult(new { code = 200, msg = "查询成功", count = goods.Count, result = goods }); } return new ObjectResult(new { code = 404, sub_msg = "未查询到数据", msg = "" }); }