Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            techReview techReview = db.techReviews.Find(id);

            db.techReviews.Remove(techReview);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 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));
 }
Exemple #3
0
        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));
        }
Exemple #4
0
        // 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));
        }
Exemple #5
0
        // 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));
        }