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