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();
            }
        }
Пример #2
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());
            }
        }