예제 #1
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 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();
            }
        }