public ActionResult Index() { var query = new ProductQuery() { OwnerIDs = new long[] { GetOwnerID() }, Take = PageSize, OrderField = "LastModifiedAt", OrderDirection = OrderDirection.Desc, Includes = new string[] { "Specifications", "ProductPictures" } }; var initList = svc.Select(query).ToArray(); ViewData["Pagination"] = Pagination.FromQuery(query); ViewData["picList"] = GetItemPath(initList); return(View(initList)); }
public ActionResult AjaxQuery(ProductQuery query) { //读取StoreID if (query == null) { query = new ProductQuery(); } Boolean hasQueryed = false; if (Request.Form["hasQuery"] != null) { hasQueryed = Convert.ToBoolean(Request.Form["hasQuery"]); } if (hasQueryed) { if (query.NamePattern != null) { query.NamePattern = query.NamePattern.Trim(); } } else { query.NamePattern = null; } if (query.OrderField != null && query.OrderField != "") { query.OrderField = query.OrderField; } query.OwnerIDs = new long[] { GetOwnerID() }; query.Includes = new string[] { "Specifications", "ProductPictures" }; query.Take = PageSize; var products = svc.Select(query).ToArray(); var pro = Pagination.FromQuery(query); ViewBag.NamePattern = query.NamePattern; ViewData["Pagination"] = pro; ViewData["picList"] = GetItemPath(products); return(PartialView("Product/ProductList", products)); }