Exemple #1
0
        //
        // GET: /Zone/

        public ActionResult Index()
        {
            ZONE _zone = new ZONE();
            List<Zone> _list = new List<Zone>(); ;
            foreach (ZONE item in ZONE.GetList())
            {
                Zone zones = new Zone();
                zones.NOM = item.NOM;
                zones.CONTROLEUR = item.CONTROLEUR;
                zones.ID_CONT = item.ID_CONTROLER;
                zones.ID_AUTO = item.ID_AUTO;
                _list.Add(zones);
            }

            return View(_list);
        }
Exemple #2
0
        //
        // GET: /Zone/Edit/5
 
        public ActionResult Edit()
        {
            Zone zones = new Zone();
            ZONE _zone = new ZONE();

            int id = Int32.Parse(RouteData.Values["id"].ToString());

            _zone.LoadId(id);
            zones.NOM = _zone.NOM;
            zones.CONTROLEUR = _zone.CONTROLEUR;

            IEnumerable<SelectListItem> list = ToSelectListItems();
            list.ToList().Find(x => x.Text.Equals(zones.CONTROLEUR)).Selected = true;
           ViewData["ID_CONT"] = list;

            return View(zones);
        }
Exemple #3
0
        public ActionResult Create(Zone zonesToCreate)
        {
            if (!ModelState.IsValid)
                return View();

            try
            {
                ZONE _zone = new ZONE();
                _zone.NOM = zonesToCreate.NOM;
                _zone.ID_CONTROLER = zonesToCreate.ID_CONT;
                _zone.Save();
                return RedirectToAction("../Zone/Index");
            }
            catch
            {
                return View();
            }
        }
Exemple #4
0
        public ActionResult Delete(Zone zones)
        {
            int id = Int32.Parse(RouteData.Values["id"].ToString());
          
            if (!ModelState.IsValid)
                return View();

            try
            {
                ZONE _zone = new ZONE();
                _zone.SetId(id);
                _zone.Delete();
                return RedirectToAction("../Zone/Index");//reafficher l liste
            }
            catch
            {
                return View();
            }
        }
Exemple #5
0
        public ActionResult Edit(Zone zones)
        {
            int id = Int32.Parse(RouteData.Values["id"].ToString());

            if (!ModelState.IsValid)
                return View();

            try
            {
                ZONE _zone = new ZONE();
                _zone.NOM = zones.NOM;
                _zone.CONTROLEUR = zones.CONTROLEUR;
                _zone.ID_CONTROLER = zones.ID_CONT;
                _zone.SetId(id);
                _zone.Save();
                return RedirectToAction("../Zone/Index");
            }
            catch
            {
                return View();
            }
        }