// GET: 客戶資料 public ActionResult Index() { //var isSysAdmin = User.IsInRole("sysadmin"); var cust = RepoCust.All(); return(View(cust)); }
public ActionResult DeleteConfirmed(int id) { 客戶資料 客戶資料 = RepoCust.Find(id); RepoCust.Delete(客戶資料); RepoCust.UnitOfWork.Commit(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,客戶Id,職稱,姓名,Email,手機,電話,IsDeleted")] 客戶聯絡人 客戶聯絡人) { if (ModelState.IsValid) { RepoContact.UnitOfWork.Context.Entry(客戶聯絡人).State = EntityState.Modified; RepoContact.UnitOfWork.Commit(); return(RedirectToAction("Index")); } ViewBag.客戶Id = new SelectList(RepoCust.All(), "Id", "客戶名稱", 客戶聯絡人.客戶Id); return(View(客戶聯絡人)); }
public ActionResult Create([Bind(Include = "Id,客戶名稱,統一編號,電話,傳真,地址,Email,客戶分類Id")] 客戶資料 客戶資料) { if (ModelState.IsValid) { RepoCust.Add(客戶資料); RepoCust.UnitOfWork.Commit(); return(RedirectToAction("Index")); } return(View(客戶資料)); }
// GET: 客戶資料/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } 客戶資料 客戶資料 = RepoCust.Find(id); if (客戶資料 == null) { return(HttpNotFound()); } return(View(客戶資料)); }
// GET: 客戶聯絡人/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } 客戶聯絡人 客戶聯絡人 = RepoContact.Find(id); if (客戶聯絡人 == null) { return(HttpNotFound()); } ViewBag.客戶Id = new SelectList(RepoCust.All(), "Id", "客戶名稱", 客戶聯絡人.客戶Id); return(View(客戶聯絡人)); }
// GET: 客戶資料/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } 客戶資料 客戶資料 = RepoCust.Find(id); if (客戶資料 == null) { return(HttpNotFound()); } 客戶資料.PWD = string.Empty; return(View(客戶資料)); }
// GET: 客戶資料/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } 客戶資料 cust = RepoCust.Find(id); if (cust == null) { return(HttpNotFound()); } return(View(cust)); }
public ActionResult Edit(int id, FormCollection form) { var customer = RepoCust.Find(id); if (TryUpdateModel(customer, "客戶名稱,統一編號,電話,傳真,地址,Email,客戶分類Id,Account".Split(','))) { if (!string.IsNullOrEmpty(form["PWD"])) { customer.PWD = FormsAuthentication.HashPasswordForStoringInConfigFile(form["PWD"], "SHA1"); } RepoCust.UnitOfWork.Commit(); ViewBag.IsCommitted = true; if (User.IsInRole("sysadmin")) { return(RedirectToAction("Index")); } } customer.PWD = string.Empty; return(View(customer)); }
// GET: 客戶聯絡人/Create public ActionResult Create() { ViewBag.客戶Id = new SelectList(RepoCust.All(), "Id", "客戶名稱"); return(View()); }