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