public ActionResult Edit(int?id) { if (!id.HasValue) { return(HttpNotFound()); } var data = repo.Where(p => p.Id == id).FirstOrDefault(); ViewBag.客戶Id = new SelectList(repoCustomer.All(), "Id", "客戶名稱"); return(View(data)); }