コード例 #1
0
 // GET: Tournoi/Delete/5
 public ActionResult Delete(int id)
 {
     ServiceJediClient service = new ServiceJediClient();
     TournoiWCF t = service.getAllTournoi().ToList().Find(x => x.Id == id);
     if (t == null)
     {
         return HttpNotFound();
     }
     return View(new TournoiModels(t));
 }
コード例 #2
0
        // GET: Tournoi/Delete/5
        public ActionResult Delete(int id)
        {
            ServiceJediClient service = new ServiceJediClient();
            TournoiWCF        t       = service.getAllTournoi().ToList().Find(x => x.Id == id);

            if (t == null)
            {
                return(HttpNotFound());
            }
            return(View(new TournoiModels(t)));
        }
コード例 #3
0
 // GET: Tournoi/Details/5
 public ActionResult Details(int id, int bank)
 {
     ServiceJediClient service = new ServiceJediClient();
     TournoiWCF t = service.getAllTournoi().ToList().Find(x => x.Id == id);
     if (t == null)
     {
         return HttpNotFound();
     }
     TournoiModels tModels = new TournoiModels(t);
     tModels.bank = bank;
     return View(tModels);
 }
コード例 #4
0
        // GET: Tournoi
        public ActionResult Index()
        {
            ServiceJediClient    service = new ServiceJediClient();
            List <TournoiModels> list    = new List <TournoiModels>();

            foreach (TournoiWCF t in service.getAllTournoi())
            {
                list.Add(new TournoiModels(t));
            }

            return(View(list));
        }
コード例 #5
0
        public ActionResult Details(int id, int bank, int bet, int jediBet)
        {
            ServiceJediClient service = new ServiceJediClient();
            TournoiWCF        t       = service.getAllTournoi().ToList().Find(x => x.Id == id);

            bank -= bet;
            if (t == null)
            {
                return(HttpNotFound());
            }
            if (t.Matches.ToList().Count == 1)
            {
                return(RedirectToAction("End", new { bank = bank, win = true, idJedi = t.Matches[0].Jedi1.Id }));
            }
            else
            {
                // Jouer les matches et recuperer le nouveau tournois
                TournoiWCF tnew = service.playTournoi(t);
                string     nom  = t.Nom + " " + tnew.Matches[0].PhaseTournoi;
                tnew.Nom = nom;
                service.addTournoi(tnew);
                tnew = service.getAllTournoi().ToList().Find(x => x.Nom == nom);

                // Determine si le joueur a gagne
                bool win = false;
                for (int i = 0; i < tnew.Matches.ToList().Count&& !win; i++)
                {
                    if (tnew.Matches[i].Jedi1.Id == jediBet ||
                        tnew.Matches[i].Jedi2.Id == jediBet)
                    {
                        win   = true;
                        bank += bet * 2;
                    }
                }

                return(RedirectToAction("Details", new { Id = tnew.Id, bank = bank }));
            }
        }
コード例 #6
0
        // GET: Tournoi/Details/5
        public ActionResult Details(int id, int bank)
        {
            ServiceJediClient service = new ServiceJediClient();
            TournoiWCF        t       = service.getAllTournoi().ToList().Find(x => x.Id == id);

            if (t == null)
            {
                return(HttpNotFound());
            }
            TournoiModels tModels = new TournoiModels(t);

            tModels.bank = bank;
            return(View(tModels));
        }
コード例 #7
0
        public ActionResult ListJediConcourant(int id)
        {
            ServiceJediClient service = new ServiceJediClient();
            List <JediModels> list    = new List <JediModels>();

            TournoiWCF t = service.getAllTournoi().ToList().Find(x => x.Id == id);

            foreach (MatchWCF m in t.Matches)
            {
                list.Add(new JediModels(m.Jedi1));
                list.Add(new JediModels(m.Jedi2));
            }
            list.Sort(delegate(JediModels x, JediModels y)
            {
                return(x.Nom.CompareTo(y.Nom));
            });
            return(PartialView(list));
        }
コード例 #8
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                ServiceJediClient service = new ServiceJediClient();
                TournoiWCF t = service.getAllTournoi().ToList().Find(x => x.Id == id);
                if (t == null)
                {
                    return HttpNotFound();
                }
                service.deleteTournois(t);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
コード例 #9
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                ServiceJediClient service = new ServiceJediClient();
                TournoiWCF        t       = service.getAllTournoi().ToList().Find(x => x.Id == id);
                if (t == null)
                {
                    return(HttpNotFound());
                }
                service.deleteTournois(t);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #10
0
        public ActionResult Details(int id, int bank, int bet, int jediBet)
        {
            ServiceJediClient service = new ServiceJediClient();
            TournoiWCF t = service.getAllTournoi().ToList().Find(x => x.Id == id);
            bank -= bet;
            if (t == null)
            {
                return HttpNotFound();
            }
            if (t.Matches.ToList().Count == 1)
            {
                return RedirectToAction("End",new { bank = bank, win = true, idJedi = t.Matches[0].Jedi1.Id });
            }
            else
            {
                // Jouer les matches et recuperer le nouveau tournois
                TournoiWCF tnew = service.playTournoi(t);
                string nom = t.Nom + " " + tnew.Matches[0].PhaseTournoi;
                tnew.Nom = nom;
                service.addTournoi(tnew);
                tnew = service.getAllTournoi().ToList().Find(x => x.Nom == nom);

                // Determine si le joueur a gagne
                bool win = false;
                for(int i=0; i<tnew.Matches.ToList().Count && !win; i++)
                {
                    if(tnew.Matches[i].Jedi1.Id == jediBet ||
                        tnew.Matches[i].Jedi2.Id == jediBet)
                    {
                        win = true;
                        bank += bet * 2;
                    }
                }

                return RedirectToAction("Details", new { Id = tnew.Id, bank = bank });
            }
        }
コード例 #11
0
        public ActionResult ListJediConcourant(int id)
        {
            ServiceJediClient service = new ServiceJediClient();
            List<JediModels> list = new List<JediModels>();

            TournoiWCF t = service.getAllTournoi().ToList().Find(x => x.Id == id);

            foreach (MatchWCF m in t.Matches)
            {
                list.Add(new JediModels(m.Jedi1));
                list.Add(new JediModels(m.Jedi2));
            }
            list.Sort(delegate (JediModels x, JediModels y)
            {
                return x.Nom.CompareTo(y.Nom);
            });
            return PartialView(list);
        }
コード例 #12
0
        // GET: Tournoi
        public ActionResult Index()
        {
            ServiceJediClient service = new ServiceJediClient();
            List<TournoiModels> list = new List<TournoiModels>();

            foreach (TournoiWCF t in service.getAllTournoi())
            {
                list.Add(new TournoiModels(t));
            }

            return View(list);
        }