public ActionResult Edit([Bind(Include = "ID,StartDate,Title,Description")] PeriodicVisits periodicVisits) { if (ModelState.IsValid) { db.Entry(periodicVisits).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(periodicVisits)); }
public ActionResult Create([Bind(Include = "ID,StartDate,Title,Description")] PeriodicVisits periodicVisits) { if (ModelState.IsValid) { db.PeriodicVisits.Add(periodicVisits); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(periodicVisits)); }
// GET: Admin/PeriodicVisits/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PeriodicVisits periodicVisits = db.PeriodicVisits.Find(id); if (periodicVisits == null) { return(HttpNotFound()); } return(View(periodicVisits)); }
public ActionResult DeleteConfirmed(int id) { PeriodicVisits periodicVisits = db.PeriodicVisits.Find(id); try { db.PeriodicVisits.Remove(periodicVisits); db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception) { ViewBag.Error = true; return(View("Delete")); } }