public ActionResult DeleteConfirmed(int id) { techReview techReview = db.techReviews.Find(id); db.techReviews.Remove(techReview); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,Item,Review,Published,CategoryID")] techReview techReview) { if (ModelState.IsValid) { db.Entry(techReview).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryID = new SelectList(db.Categories, "ID", "Name", techReview.CategoryID); return(View(techReview)); }
public ActionResult Create([Bind(Include = "ID,Item,Review,Published,CategoryID")] techReview techReview) { if (ModelState.IsValid) { db.techReviews.Add(techReview); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryID = new SelectList(db.Categories, "ID", "Name", techReview.CategoryID); return(View(techReview)); }
// GET: techReviews/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } techReview techReview = db.techReviews.Find(id); if (techReview == null) { return(HttpNotFound()); } return(View(techReview)); }
// GET: techReviews/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } techReview techReview = db.techReviews.Find(id); if (techReview == null) { return(HttpNotFound()); } ViewBag.CategoryID = new SelectList(db.Categories, "ID", "Name", techReview.CategoryID); return(View(techReview)); }