public ActionResult DeleteConfirmed(int id) { AppleFact appleFact = db.AppleFacts.Find(id); db.AppleFacts.Remove(appleFact); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Type,Fact")] AppleFact appleFact) { if (ModelState.IsValid) { db.Entry(appleFact).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(appleFact)); }
public ActionResult Create([Bind(Include = "Id,Type,Fact")] AppleFact appleFact) { if (ModelState.IsValid) { db.AppleFacts.Add(appleFact); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(appleFact)); }
// GET: AppleFacts/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AppleFact appleFact = db.AppleFacts.Find(id); if (appleFact == null) { return(HttpNotFound()); } return(View(appleFact)); }