// GET: Product/Create
        public ActionResult Create()
        {
            PublicitesModel pm = new PublicitesModel();
            //pour recupérer un  champ spécifique  Select(c=>c.name)

            IEnumerable <Produit> Prods = db.Produits.ToList();

            ViewBag.p = Prods;



            return(View(pm));
        }
        public ActionResult Create(PublicitesModel pm, HttpPostedFileBase Image, Publicite publicite)
        {
            publicite.Products = db.Produits.Find(Convert.ToInt32(publicite.idProducts));

            pm.Image = Image.FileName;
            Publicite p = new Publicite()
            {
                Titre = pm.Titre,

                Products = db.Produits.Find(Convert.ToInt32(publicite.idProducts)),

                Description = pm.Description,
                Image       = pm.Image,
                idProducts  = pm.idProducts
            };


            var path = Path.Combine(Server.MapPath("~/Content/Upload/"), Image.FileName);

            Image.SaveAs(path);



            try
            {
                // TODO: Add insert logic here
                sp.Add(p);
                // listprod.Add(p);

                // Session["Products"] = listprod;

                sp.Commit();
                return(RedirectToAction("ListePublicitee"));
            }
            catch
            {
                return(View());
            }
        }