public ActionResult DeleteConfirmed(int id) { ShopCarousel shopCarousel = db.ShopCarousels.Find(id); db.ShopCarousels.Remove(shopCarousel); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: ShopCarousels/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ShopCarousel shopCarousel = db.ShopCarousels.Find(id); if (shopCarousel == null) { return(HttpNotFound()); } return(View(shopCarousel)); }
public ActionResult Edit([Bind(Include = "shopCarouselID,show")] ShopCarousel shopCarousel, HttpPostedFileBase file) { if (ModelState.IsValid) { if (shopCarousel.show == null) { shopCarousel.show = false; } db.Entry(shopCarousel).State = EntityState.Modified; db.SaveChanges(); if (file != null) { file.SaveAs(Server.MapPath("~/Images/ShopCarousel/" + shopCarousel.shopCarouselID + ".jpg")); } return(RedirectToAction("Index")); } return(View(shopCarousel)); }