Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ShopCarousel shopCarousel = db.ShopCarousels.Find(id);

            db.ShopCarousels.Remove(shopCarousel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        // 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));
        }
Esempio n. 3
0
        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));
        }