public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                ServiceJediClient         service = new ServiceJediClient();
                List <CaracteristiqueWCF> listCar = service.getAllCaracteristique().ToList();

                StadeWCF stadeWCF = service.getAllStade().ToList().Find(x => x.Id == id);
                stadeWCF.Planete  = collection[2];
                stadeWCF.NbPlaces = Int32.Parse(collection[3]);

                List <CaracteristiqueWCF> listCarRes = new List <CaracteristiqueWCF>();
                char[]   delimiterChars = { ',' };
                string[] caractStr      = collection[4].Split(delimiterChars);
                foreach (string str in caractStr)
                {
                    if (str != "false")
                    {
                        listCarRes.Add(listCar.Find(x => x.Id == Int32.Parse(str)));
                    }
                }

                stadeWCF.Caracteristiques = listCarRes.ToArray();

                service.updateStade(stadeWCF);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
 // GET: Stade/Delete/5
 public ActionResult Delete(int id)
 {
     ServiceJediClient service = new ServiceJediClient();
     StadeWCF stade = service.getAllStade().ToList().Find(x => x.Id == id);
     if (stade == null)
     {
         return HttpNotFound();
     }
     return View(new StadeModels(stade));
 }
        // GET: Stade/Edit/5
        public ActionResult Edit(int id)
        {
            ServiceJediClient service = new ServiceJediClient();
            StadeWCF          stade   = service.getAllStade().ToList().Find(x => x.Id == id);

            if (stade == null)
            {
                return(HttpNotFound());
            }
            return(View(new StadeModels(stade)));
        }
        public ActionResult ListStade()
        {
            ServiceJediClient  service = new ServiceJediClient();
            List <StadeModels> list    = new List <StadeModels>();

            foreach (StadeWCF s in service.getAllStade())
            {
                list.Add(new StadeModels(s));
            }
            return(PartialView(list));
        }
        // GET: Stade
        public ActionResult Index()
        {
            ServiceJediClient  service = new ServiceJediClient();
            List <StadeModels> list    = new List <StadeModels>();

            foreach (StadeWCF stade in service.getAllStade())
            {
                list.Add(new StadeModels(stade));
            }

            return(View(list));
        }
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                ServiceJediClient service = new ServiceJediClient();
                StadeWCF stade = service.getAllStade().ToList().Find(x => x.Id == id);
                if (stade == null)
                {
                    return HttpNotFound();
                }
                service.deleteStade(stade);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                ServiceJediClient service = new ServiceJediClient();
                StadeWCF          stade   = service.getAllStade().ToList().Find(x => x.Id == id);
                if (stade == null)
                {
                    return(HttpNotFound());
                }
                service.deleteStade(stade);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Пример #8
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                ServiceJediClient service    = new ServiceJediClient();
                List <JediWCF>    listJedis  = service.getAllJedi().ToList();
                List <StadeWCF>   listStades = service.getAllStade().ToList();
                MatchWCF          match      = service.getAllMatch().ToList().Find(x => x.Id == id);
                match.Jedi1        = listJedis.Find(x => x.Id == Int32.Parse(collection[2]));
                match.Jedi2        = listJedis.Find(x => x.Id == Int32.Parse(collection[3]));
                match.PhaseTournoi = (EPhaseTournoi)Enum.Parse(typeof(EPhaseTournoi), collection[4], true);
                match.Stade        = listStades.Find(x => x.Id == Int32.Parse(collection[5]));

                service.updateMatch(match);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                string str1 = collection[0];
                string str2 = collection[1];

                ServiceJediClient service = new ServiceJediClient();
                List<JediWCF> listJedis = service.getAllJedi().ToList();
                List<StadeWCF> listStades = service.getAllStade().ToList();
                MatchWCF match = new MatchWCF();
                match.Jedi1 = listJedis.Find(x => x.Id == Int32.Parse(collection[1]));
                match.Jedi2 = listJedis.Find(x => x .Id == Int32.Parse(collection[2]));
                match.PhaseTournoi = (EPhaseTournoi)Enum.Parse(typeof(EPhaseTournoi), collection[3], true);
                match.Stade = listStades.Find(x => x.Id == Int32.Parse(collection[4]));

                service.addMatch(match);
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
Пример #10
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                string str1 = collection[0];
                string str2 = collection[1];

                ServiceJediClient service    = new ServiceJediClient();
                List <JediWCF>    listJedis  = service.getAllJedi().ToList();
                List <StadeWCF>   listStades = service.getAllStade().ToList();
                MatchWCF          match      = new MatchWCF();
                match.Jedi1        = listJedis.Find(x => x.Id == Int32.Parse(collection[1]));
                match.Jedi2        = listJedis.Find(x => x.Id == Int32.Parse(collection[2]));
                match.PhaseTournoi = (EPhaseTournoi)Enum.Parse(typeof(EPhaseTournoi), collection[3], true);
                match.Stade        = listStades.Find(x => x.Id == Int32.Parse(collection[4]));

                service.addMatch(match);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
 public ActionResult ListStade()
 {
     ServiceJediClient service = new ServiceJediClient();
     List<StadeModels> list = new List<StadeModels>();
     foreach (StadeWCF s in service.getAllStade())
     {
         list.Add(new StadeModels(s));
     }
     return PartialView(list);
 }
        // GET: Stade
        public ActionResult Index()
        {
            ServiceJediClient service = new ServiceJediClient();
            List<StadeModels> list = new List<StadeModels>();

            foreach (StadeWCF stade in service.getAllStade())
            {
                list.Add(new StadeModels(stade));
            }

            return View(list);
        }
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                ServiceJediClient service = new ServiceJediClient();
                List<CaracteristiqueWCF> listCar = service.getAllCaracteristique().ToList();

                StadeWCF stadeWCF = service.getAllStade().ToList().Find(x => x.Id == id);
                stadeWCF.Planete = collection[2];
                stadeWCF.NbPlaces = Int32.Parse(collection[3]);

                List<CaracteristiqueWCF> listCarRes = new List<CaracteristiqueWCF>();
                char[] delimiterChars = { ',' };
                string[] caractStr = collection[4].Split(delimiterChars);
                foreach (string str in caractStr)
                {
                    if (str != "false")
                    {
                        listCarRes.Add(listCar.Find(x => x.Id == Int32.Parse(str)));
                    }
                }

                stadeWCF.Caracteristiques = listCarRes.ToArray();

                service.updateStade(stadeWCF);
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                ServiceJediClient service = new ServiceJediClient();
                List<JediWCF> listJedis = service.getAllJedi().ToList();
                List<StadeWCF> listStades = service.getAllStade().ToList();
                MatchWCF match = service.getAllMatch().ToList().Find(x => x.Id == id);
                match.Jedi1 = listJedis.Find(x => x.Id == Int32.Parse(collection[2]));
                match.Jedi2 = listJedis.Find(x => x.Id == Int32.Parse(collection[3]));
                match.PhaseTournoi = (EPhaseTournoi)Enum.Parse(typeof(EPhaseTournoi), collection[4], true);
                match.Stade = listStades.Find(x => x.Id == Int32.Parse(collection[5]));

                service.updateMatch(match);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }