public ActionResult Edit([Bind(Include = "Id,客戶名稱,統一編號,電話,傳真,地址,Email")] 客戶資料 客戶資料)
 {
     if (ModelState.IsValid)
     {
         db.Entry(客戶資料).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(客戶資料));
 }
 public ActionResult Edit([Bind(Include = "Id,客戶Id,銀行名稱,銀行代碼,分行代碼,帳戶名稱,帳戶號碼")] 客戶銀行資訊 客戶銀行資訊)
 {
     if (ModelState.IsValid)
     {
         db.Entry(客戶銀行資訊).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.客戶Id = new SelectList(db.客戶資料, "Id", "客戶名稱", 客戶銀行資訊.客戶Id);
     return(View(客戶銀行資訊));
 }
示例#3
0
        public ActionResult Edit([Bind(Include = "Id,客戶Id,職稱,姓名,Email,手機,電話")] 客戶聯絡人 客戶聯絡人)
        {
            if (ModelState.IsValid)
            {
                客戶聯絡人.Email = 客戶聯絡人.Email.Trim();

                if (客戶聯絡人.CheckMailChanged(客戶聯絡人.Id, 客戶聯絡人.Email) && 客戶聯絡人.CheckEmailIsUnique(客戶聯絡人.客戶Id, 客戶聯絡人.Email))
                {
                    ModelState.AddModelError("Email", "客戶Email資料重複,無法新增,請您確認一下客戶聯繫Email資料");

                    ViewBag.客戶Id = new SelectList(db.客戶資料, "Id", "客戶名稱", 客戶聯絡人.客戶Id);
                    return(View(客戶聯絡人));
                }
                else
                {
                    db.Entry(客戶聯絡人).State = EntityState.Modified;
                    db.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }
            ViewBag.客戶Id = new SelectList(db.客戶資料, "Id", "客戶名稱", 客戶聯絡人.客戶Id);
            return(View(客戶聯絡人));
        }