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