public ActionResult DeleteConfirmed(int id) { ctgs ctgs = db.categories_table.Find(id); db.categories_table.Remove(ctgs); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,CategoryName")] ctgs ctgs) { if (ModelState.IsValid) { db.Entry(ctgs).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ctgs)); }
public ActionResult Create([Bind(Include = "Id,CategoryName")] ctgs ctgs) { if (ModelState.IsValid) { db.categories_table.Add(ctgs); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ctgs)); }
// GET: ctgs/Edit/5 public ActionResult Edit(int?id) { if (Admincheck()) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ctgs ctgs = db.categories_table.Find(id); if (ctgs == null) { return(HttpNotFound()); } return(View(ctgs)); } else { return(Content("You do not have access to this data ")); } }