/// <summary> /// 商品管理(按状态) /// </summary> /// <param name="status"></param> /// <returns></returns> public string ManageGoods(GoodsInfoStatus status) { return(CachedUrlHelper.Action("ManageGoods", "SystemGoods", "SystemGoods", new RouteValueDictionary() { { "status", status } })); }
/// <summary> /// 管理商品 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public IActionResult ManageGoods(GoodsInfoSortBy?sort, int?pageIndex, int pageSize = 20, GoodsInfoStatus status = GoodsInfoStatus.Sale) { var from = RequestHelper.GetQueryParams(Request); ViewData["currentUser"] = UserContext.CurrentUser; GoodsInfoQuery query = new GoodsInfoQuery(); query.Keyword = from["keyWord"]; query.Keynum = from["keynum"]; query.CategoryLavel = from["categoryLavel"]; query.GoodsInfoStatus = status; ViewData["Status"] = status; if (sort.HasValue) { query.GoodsInfoSortBy = sort.Value; ViewData["Sort"] = query.GoodsInfoSortBy; } decimal result = decimal.Zero; if (decimal.TryParse(from["goodsPriceLowerLimit"], out result)) { query.GoodsPriceLowerLimit = from["goodsPriceLowerLimit"].AsDecimal(); ViewData["GoodsPriceLowerLimit"] = query.GoodsPriceLowerLimit; } if (decimal.TryParse(from["goodsPriceUpperLimit"], out result)) { query.GoodsPriceUpperLimit = from["goodsPriceUpperLimit"].AsDecimal(); ViewData["GoodsPriceUpperLimit"] = query.GoodsPriceUpperLimit; } int buyResult = 0; if (int.TryParse(from["buyCountLowerLimit"], out buyResult)) { query.BuyCountLowerLimit = from["buyCountLowerLimit"].AsInt(); ViewData["BuyCountLowerLimit"] = query.BuyCountLowerLimit; } if (int.TryParse(from["buyCountUpperLimit"], out buyResult)) { query.BuyCountUpperLimit = from["buyCountTimeUpperLimit"].AsInt(); ViewData["BuyCountUpperLimit"] = query.BuyCountUpperLimit; } if (!string.IsNullOrWhiteSpace(query.Keyword)) { ViewData["Keyword"] = query.Keyword; } if (!string.IsNullOrWhiteSpace(query.Keynum)) { ViewData["Keynum"] = query.Keynum; } pageIndex = pageIndex ?? 1; PagingDataSet <GoodsInfo> paging = goodsInfoService.GetPageGoodsInfo(query, pageIndex.Value, pageSize); if (pageIndex > 1 && (paging == null || paging.Count() == 0)) { paging = goodsInfoService.GetPageGoodsInfo(query, pageSize, pageIndex.Value - 1); } return(View(paging)); }