//
        // GET: /VenteDetails/

        public ActionResult Index()
        {
            VENTE_DETAILS _venteDetails = new VENTE_DETAILS();

            List<Vente_Details> _list = new List<Vente_Details>(); ;
            foreach (VENTE_DETAILS item in VENTE_DETAILS.GetList())
            {
                Vente_Details ventesDetails = new Vente_Details();
                
                ventesDetails.ID_AUTO = item.ID_AUTO;
                ventesDetails.ID_CHARGEMENT = item.ID_CHARGEMENT;
                ventesDetails.ID_VENTE = item.ID_VENTE;

                VENTE vente = new VENTE();
                vente.LoadId(item.ID_VENTE);

                ventesDetails.VENTE = vente.ToString();

                CHARGERMENT charge = new CHARGERMENT();
                charge.LoadId(item.ID_CHARGEMENT);

                ventesDetails.CHARGEMENT = charge.ToString();

                ventesDetails.PRIX_UNITAIRE= item.PRIX_UNITAIRE;
                ventesDetails.QTE = item.QTE;
                ventesDetails.TOTAL = item.TOTAL;
                _list.Add(ventesDetails);
            }

            return View(_list);
        }
        //
        // GET: /VenteDetails/Delete/5
 
        public ActionResult Delete()
        {
            int id = Int32.Parse(RouteData.Values["id"].ToString());
          
            Vente_Details ventesDetails = new Vente_Details();
            VENTE_DETAILS _venteDetails = new VENTE_DETAILS();
            _venteDetails.LoadId(id);
            ventesDetails.TOTAL = _venteDetails.TOTAL;
            ventesDetails.QTE = _venteDetails.QTE;
            ventesDetails.PRIX_UNITAIRE = _venteDetails.PRIX_UNITAIRE;
            ventesDetails.ID_VENTE = _venteDetails.ID_VENTE;
            ventesDetails.ID_CHARGEMENT = _venteDetails.ID_CHARGEMENT;

            VENTE vente = new VENTE();
            vente.LoadId(_venteDetails.ID_VENTE);

            ventesDetails.VENTE = vente.ToString();

            CHARGERMENT charge = new CHARGERMENT();
            charge.LoadId(_venteDetails.ID_CHARGEMENT);

            ventesDetails.CHARGEMENT = charge.ToString();


            IEnumerable<SelectListItem> list = ToSelectListItems();
            list.ToList().Find(x => x.Text.Equals(ventesDetails.VENTE)).Selected = true;
            ViewData["ID_VENTE"] = list;

            IEnumerable<SelectListItem> list1 = ToSelectListItems1();
            list1.ToList().Find(x => x.Text.Equals(ventesDetails.CHARGEMENT)).Selected = true;
            ViewData["ID_CHARGEMENT"] = list1;

            return View(ventesDetails);
        }