public ActionResult Edit(客戶銀行資訊 客戶銀行資訊) { if (ModelState.IsValid) { repo.Update(客戶銀行資訊); repo.UnitOfWork.Commit(); return(RedirectToAction("Index")); } ViewBag.客戶Id = new SelectList(repo.Get取得客戶資料選單列表(), "Id", "客戶名稱", 客戶銀行資訊.客戶Id); return(View(客戶銀行資訊)); }
public ActionResult Edit([Bind(Include = "Id,客戶Id,銀行名稱,銀行代碼,分行代碼,帳戶名稱,帳戶號碼")] 客戶銀行資訊 客戶銀行資訊) { if (ModelState.IsValid) { repo.Update(客戶銀行資訊); repo.UnitOfWork.Commit(); return(RedirectToAction("Index")); } InitDropDownList(客戶銀行資訊); return(View(客戶銀行資訊)); }
public ActionResult Edit([Bind(Include = "Id,客戶Id,銀行名稱,銀行代碼,分行代碼,帳戶名稱,帳戶號碼")] 客戶銀行資訊 客戶銀行資訊) { if (ModelState.IsValid) { bankrepo.Update(客戶銀行資訊); bankrepo.UnitOfWork.Commit(); return(RedirectToAction("Index")); } ViewBag.客戶Id = new SelectList(custrepo.All(), "Id", "客戶名稱", 客戶銀行資訊.客戶Id); return(View(客戶銀行資訊)); }
//public ActionResult Edit([Bind(Include = "Id,客戶Id,銀行名稱,銀行代碼,分行代碼,帳戶名稱,帳戶號碼")] 客戶銀行資訊 客戶銀行資訊) public ActionResult Edit(int id, FormCollection form) { var 客戶銀行資訊 = repo.Get單筆資料ById(id); if (TryUpdateModel(客戶銀行資訊)) { //db.Entry(客戶銀行資訊).State = EntityState.Modified; //db.SaveChanges(); repo.Update(客戶銀行資訊); return(RedirectToAction("Index")); } ViewBag.客戶Id = new SelectList(repo客戶資料.All(), "Id", "客戶名稱", 客戶銀行資訊.客戶Id); return(View(客戶銀行資訊)); }
public ActionResult Edit([Bind(Include = "Id,客戶Id,銀行名稱,銀行代碼,分行代碼,帳戶名稱,帳戶號碼,是否已刪除")] 客戶銀行資訊 客戶銀行資訊) { if (ModelState.IsValid) { //db.Entry(客戶銀行資訊).State = EntityState.Modified; //db.SaveChanges(); repo.Update(客戶銀行資訊); repo.UnitOfWork.Commit(); return(RedirectToAction("Index")); } //ViewBag.客戶Id = new SelectList(db.客戶資料.Where(c => c.是否已刪除 == false), "Id", "客戶名稱", 客戶銀行資訊.客戶Id); ViewBag.客戶Id = new SelectList(repo.All(), "Id", "客戶名稱", 客戶銀行資訊.客戶Id); return(View(客戶銀行資訊)); }