// GET: 客戶資料 public ActionResult Index(string clientName, string clientType, string sortOrder) { #region 排序欄位 ViewBag.sort客戶名稱 = string.IsNullOrEmpty(sortOrder) ? "客戶名稱_desc" : ""; ViewBag.sort統一編號 = sortOrder == "統一編號" ? "統一編號_desc" : "統一編號"; ViewBag.sort電話 = sortOrder == "電話" ? "電話_desc" : "電話"; ViewBag.sort傳真 = sortOrder == "傳真" ? "傳真_desc" : "傳真"; ViewBag.sort地址 = sortOrder == "地址" ? "地址_desc" : "地址"; ViewBag.sortEmail = sortOrder == "Email" ? "Email_desc" : "Email"; ViewBag.sort客戶分類 = sortOrder == "客戶分類" ? "客戶分類_desc" : "客戶分類"; #endregion var data = 客戶repo.GetQueryData(clientName, clientType, sortOrder); List <SelectListItem> type = 客戶repo.Get客戶分類List(); ViewBag.clientType = type; return(View(data)); }