public ActionResult Create(客戶資料 客戶資料) { if (ModelState.IsValid) { repo.Add(客戶資料); repo.Commit(); //db.客戶.Add(客戶); //db.SaveChanges(); return RedirectToAction("Index"); } return View(客戶資料); }
public ActionResult Edit(客戶資料 客戶) { if (ModelState.IsValid) { //db.Entry(客戶).State = EntityState.Modified; //db.SaveChanges(); using (SHA256CryptoServiceProvider csp = new SHA256CryptoServiceProvider()) { var p = 客戶.密碼; 客戶.密碼 = BitConverter.ToString(csp.ComputeHash(Encoding.Default.GetBytes(p))).Replace("-", ""); } repo.Edit(客戶); repo.Commit(); return RedirectToAction("Index"); } return View(客戶); }