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