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