public ActionResult DeleteConfirmed(int id) { Models.Church church = db.Churches.Find(id); db.Churches.Remove(church); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ChurchID,ChurchName,Address,City,State,ZipCode,Phone,CityID")] Models.Church church) { if (ModelState.IsValid) { db.Entry(church).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CityID = new SelectList(db.Cities, "CityID", "CityName", church.CityID); return(View(church)); }
// GET: Churches/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Models.Church church = db.Churches.Find(id); if (church == null) { return(HttpNotFound()); } return(View(church)); }
// GET: Churches/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Models.Church church = db.Churches.Find(id); if (church == null) { return(HttpNotFound()); } ViewBag.CityID = new SelectList(db.Cities, "CityID", "CityName", church.CityID); return(View(church)); }