public ActionResult Update(int?id, 客戶資料 customer) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "id should not be null.")); } if (ModelState.IsValid) { if (repo.IsExist(id.Value)) { ViewBag.客戶分類List = Get客戶分類(customer.客戶分類.HasValue ? customer.客戶分類.Value : 0); repo.Update(customer); repo.UnitOfWork.Commit(); return(RedirectToAction("Index")); } else { return(HttpNotFound("Not found customer.")); } } ViewData.Model = customer; return(View()); }
public ActionResult Create(客戶銀行資訊 bankInfo) { if (ModelState.IsValid) { if (repoCustomer.IsExist(bankInfo.客戶Id)) { repoBankInfo.Add(bankInfo); repoBankInfo.UnitOfWork.Commit(); return(RedirectToAction("Index")); } else { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } } ViewBag.客戶Id = new SelectList(repoCustomer.All(), "Id", "客戶名稱", bankInfo.客戶Id); ViewData.Model = bankInfo; return(View()); }
public JsonResult DuplicateEmail(string Email) { return(Json(repo客戶.IsExist(Email), JsonRequestBehavior.AllowGet)); }