public ActionResult DeleteConfirmed(int id)
        {
            Parag_image parag_image = db.paragImages.Find(id);

            db.paragImages.Remove(parag_image);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult DeleteConfirmed2(int id)
        {
            Parag_image parag_image = db.paragImages.Find(id);
            var         idParag     = parag_image.ParagrapheId;

            db.paragImages.Remove(parag_image);
            db.SaveChanges();
            //return RedirectToAction("Index");
            return(RedirectToAction("Edit", "Paragraphes", new { id = idParag }));
        }
 public ActionResult Edit([Bind(Include = "id,position,ImageId,ParagrapheId")] Parag_image parag_image)
 {
     if (ModelState.IsValid)
     {
         db.Entry(parag_image).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ImageId      = new SelectList(db.images, "id", "nom", parag_image.ImageId);
     ViewBag.ParagrapheId = new SelectList(db.paragraphes, "id", "titre", parag_image.ParagrapheId);
     return(View(parag_image));
 }
        // GET: Parag_image/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Parag_image parag_image = db.paragImages.Find(id);

            if (parag_image == null)
            {
                return(HttpNotFound());
            }
            return(View(parag_image));
        }
        // GET: Parag_image/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Parag_image parag_image = db.paragImages.Find(id);

            if (parag_image == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ImageId      = new SelectList(db.images, "id", "nom", parag_image.ImageId);
            ViewBag.ParagrapheId = new SelectList(db.paragraphes, "id", "titre", parag_image.ParagrapheId);
            return(View(parag_image));
        }
        public ActionResult Create2([Bind(Include = "id,position,ImageId,ParagrapheId")] Parag_image parag_image)
        {
            if (ModelState.IsValid)
            {
                db.paragImages.Add(parag_image);
                db.SaveChanges();
                //return RedirectToAction("Index");
                var id = Request["ParagrapheId"];

                return(RedirectToAction("Edit", "Paragraphes", new { id = Int32.Parse(id) }));
            }

            ViewBag.ImageId      = new SelectList(db.images, "id", "nom", parag_image.ImageId);
            ViewBag.ParagrapheId = new SelectList(db.paragraphes, "id", "titre", parag_image.ParagrapheId);
            return(View(parag_image));
        }