/// <summary> /// 配送公司列表 /// </summary> /// <param name="pageSize">每页数</param> /// <param name="pageNumber">当前页数</param> /// <returns></returns> public ActionResult List(int pageSize = 15, int pageNumber = 1) { PageModel pageModel = new PageModel(pageSize, pageNumber, AdminShipCompanies.GetShipCompanyCount()); ShipCompanyListModel model = new ShipCompanyListModel() { ShipCompanyList = AdminShipCompanies.GetShipCompanyList(pageModel.PageSize, pageModel.PageNumber), PageModel = pageModel }; MallUtils.SetAdminRefererCookie(string.Format("{0}?pageNumber={1}&pageSize={2}", Url.Action("list"), pageModel.PageNumber, pageModel.PageSize)); return(View(model)); }
/// <summary> /// 配送公司选择列表 /// </summary> /// <param name="pageSize">每页数</param> /// <param name="pageNumber">当前页数</param> /// <returns></returns> public ActionResult SelectList(int pageSize = 15, int pageNumber = 1) { PageModel pageModel = new PageModel(pageSize, pageNumber, AdminShipCompanies.GetShipCompanyCount()); List <ShipCompanyInfo> shipCompanyList = AdminShipCompanies.GetShipCompanyList(pageModel.PageSize, pageModel.PageNumber); StringBuilder result = new StringBuilder("{"); result.AppendFormat("\"totalPages\":\"{0}\",\"pageNumber\":\"{1}\",\"items\":[", pageModel.TotalPages, pageModel.PageNumber); foreach (ShipCompanyInfo shipCompanyInfo in shipCompanyList) { result.AppendFormat("{0}\"id\":\"{1}\",\"name\":\"{2}\"{3},", "{", shipCompanyInfo.ShipCoId, shipCompanyInfo.Name, "}"); } if (shipCompanyList.Count > 0) { result.Remove(result.Length - 1, 1); } result.Append("]}"); return(Content(result.ToString())); }