public ActionResult DeleteConfirmed(int id) { Advo advo = db.Advocates.Find(id); db.Advocates.Remove(advo); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "AdvoID,FirstName,LastName")] Advo advo) { if (ModelState.IsValid) { db.Entry(advo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(advo)); }
public ActionResult Edit(Advo advo) { if (ModelState.IsValid) { db.Entry(advo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(advo)); }
// GET: Advo/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Advo advo = db.Advocates.Find(id); if (advo == null) { return(HttpNotFound()); } return(View(advo)); }
public ActionResult Create([Bind(Include = "FirstName,LastName")] Advo advo) { try { if (ModelState.IsValid) { db.Advocates.Add(advo); db.SaveChanges(); return(RedirectToAction("Index")); } } catch (DataException /* dex */) { //Log the error (uncomment dex variable name and add a line here to write a log. ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator"); } return(View(advo)); }