public ActionResult DeleteConfirmed(int?id) { 客戶類型 客戶類型 = 客戶類型repo.Find(id.Value); 客戶類型repo.Delete(客戶類型); 客戶類型repo.UnitOfWork.Commit(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id,客戶分類")] 客戶類型 客戶類型) { if (ModelState.IsValid) { var db = 客戶類型repo.UnitOfWork.Context; db.Entry(客戶類型).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(客戶類型)); }
public ActionResult Create([Bind(Include = "id,客戶分類")] 客戶類型 客戶類型) { if (ModelState.IsValid) { 客戶類型repo.Add(客戶類型); 客戶類型repo.UnitOfWork.Commit(); return(RedirectToAction("Index")); } return(View(客戶類型)); }
// GET: 客戶類型/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } 客戶類型 客戶類型 = 客戶類型repo.Find(id.Value); if (客戶類型 == null) { return(HttpNotFound()); } return(View(客戶類型)); }