コード例 #1
0
        public ActionResult End(int idJedi, int bank, bool win)
        {
            ServiceJediClient service = new ServiceJediClient();

            TournoiEnd tournoiEnd = new TournoiEnd();
            string     str;

            if (win)
            {
                str = "Vous avez bien parie sur ce dernier match ! Felicitation ! ";
            }
            else
            {
                str = "Vous avez mal parie sur ce dernier match ";
            }

            JediModels jedi = new JediModels(service.getAllJedi().ToList().Find(x => x.Id == idJedi));

            tournoiEnd.Bank        = bank;
            tournoiEnd.JediGagnant = jedi.Nom;
            tournoiEnd.MessageEnd  = str;


            return(View(tournoiEnd));
        }
コード例 #2
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                ServiceJediClient         service = new ServiceJediClient();
                List <CaracteristiqueWCF> listCar = service.getAllCaracteristique().ToList();

                JediWCF jediWCF = service.getAllJedi().ToList().Find(x => x.Id == id);
                jediWCF.Nom    = collection[2];
                jediWCF.IsSith = collection[3].StartsWith("true");

                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)));
                    }
                }

                jediWCF.Caracteristiques = listCarRes.ToArray();

                service.updateJedi(jediWCF);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #3
0
 //
 // GET: /Jedi/Delete/5
 public ActionResult Delete(int id)
 {
     ServiceJediClient service = new ServiceJediClient();
     JediWCF jedi = service.getAllJedi().ToList().Find(x => x.Id == id);
     if (jedi == null)
     {
         return HttpNotFound();
     }
     return View(new JediModels(jedi));
 }
コード例 #4
0
        //
        // GET: /Jedi/Edit/5
        public ActionResult Edit(int id)
        {
            ServiceJediClient service = new ServiceJediClient();
            JediWCF           jedi    = service.getAllJedi().ToList().Find(x => x.Id == id);

            if (jedi == null)
            {
                return(HttpNotFound());
            }
            return(View(new JediModels(jedi)));
        }
コード例 #5
0
        public ActionResult ListJedi()
        {
            ServiceJediClient service = new ServiceJediClient();
            List <JediModels> list    = new List <JediModels>();

            foreach (JediWCF j in service.getAllJedi())
            {
                list.Add(new JediModels(j));
            }
            return(PartialView(list));
        }
コード例 #6
0
        //
        // GET: /Jedi/
        public ActionResult Index()
        {
            ServiceJediClient service = new ServiceJediClient();
            List <JediModels> list    = new List <JediModels>();

            foreach (JediWCF jedi in service.getAllJedi())
            {
                list.Add(new JediModels(jedi));
            }

            return(View(list));
        }
コード例 #7
0
 public ActionResult Delete(int id, FormCollection collection)
 {
     try
     {
         ServiceJediClient service = new ServiceJediClient();
         JediWCF jedi = service.getAllJedi().ToList().Find(x => x.Id == id);
         if (jedi == null)
         {
             return HttpNotFound();
         }
         service.deleteJedi(jedi);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
コード例 #8
0
 public ActionResult Delete(int id, FormCollection collection)
 {
     try
     {
         ServiceJediClient service = new ServiceJediClient();
         JediWCF           jedi    = service.getAllJedi().ToList().Find(x => x.Id == id);
         if (jedi == null)
         {
             return(HttpNotFound());
         }
         service.deleteJedi(jedi);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
コード例 #9
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());
            }
        }
コード例 #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();
            }
        }
コード例 #11
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());
            }
        }
コード例 #12
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();
            }
        }
コード例 #13
0
        public ActionResult End(int idJedi, int bank, bool win)
        {
            ServiceJediClient service = new ServiceJediClient();

            TournoiEnd tournoiEnd = new TournoiEnd();
            string str;
            if (win)
            {
                str = "Vous avez bien parie sur ce dernier match ! Felicitation ! ";
            }
            else
            {
                str = "Vous avez mal parie sur ce dernier match ";
            }

            JediModels jedi = new JediModels(service.getAllJedi().ToList().Find(x => x.Id == idJedi));

            tournoiEnd.Bank = bank;
            tournoiEnd.JediGagnant = jedi.Nom;
            tournoiEnd.MessageEnd = str;

            return View(tournoiEnd);
        }
コード例 #14
0
 public ActionResult ListJedi()
 {
     ServiceJediClient service = new ServiceJediClient();
     List<JediModels> list = new List<JediModels>();
     foreach (JediWCF j in service.getAllJedi())
     {
         list.Add(new JediModels(j));
     }
     return PartialView(list);
 }
コード例 #15
0
        //
        // GET: /Jedi/
        public ActionResult Index()
        {
            ServiceJediClient service = new ServiceJediClient();
            List<JediModels> list = new List<JediModels>();

            foreach (JediWCF jedi in service.getAllJedi())
            {
                list.Add(new JediModels(jedi));
            }

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

                JediWCF jediWCF = service.getAllJedi().ToList().Find(x => x.Id == id);
                jediWCF.Nom = collection[2];
                jediWCF.IsSith = collection[3].StartsWith("true");

                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)));
                    }
                }

                jediWCF.Caracteristiques = listCarRes.ToArray();

                service.updateJedi(jediWCF);
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }