public ActionResult DeleteConfirmed(int id) { Costumers costumers = db.Costumers.Find(id); db.Costumers.Remove(costumers); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name,Nit,Address,DepartmentId,TownshipId")] Costumers costumers) { if (ModelState.IsValid) { db.Entry(costumers).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "DepartmentName", costumers.DepartmentId); ViewBag.TownshipId = new SelectList(db.Townships, "Id", "TownshipName", costumers.TownshipId); return(View(costumers)); }
// GET: Costumers/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Costumers costumers = db.Costumers.Find(id); if (costumers == null) { return(HttpNotFound()); } return(View(costumers)); }
// GET: Costumers/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Costumers costumers = db.Costumers.Find(id); if (costumers == null) { return(HttpNotFound()); } ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "DepartmentName", costumers.DepartmentId); ViewBag.TownshipId = new SelectList(db.Townships, "Id", "TownshipName", costumers.TownshipId, "0"); return(View(costumers)); }