Exemplo n.º 1
0
        /// <summary>
        /// Adapte un Tournoi Model en Tournoi Contract.
        /// </summary>
        /// <param name="tournoi">Tournoi à adapter.</param>
        /// <returns>Tournoi contract.</returns>
        public static TournoiContract fromTournoiModel(TournoiModel tournoi)
        {
            if (tournoi == null)
                return null;

            TournoiContract tc = new TournoiContract();
            tc.ID = tournoi.ID;
            tc.Nom = tournoi.Nom;
            tc.Matchs = MatchAdapter.fromMatchModelList(tournoi.Matchs).ToArray();

            return tc;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adapte un Tournoi Contract en Tournoi Model.
        /// </summary>
        /// <param name="tournoiC">Tournoi à adapter.</param>
        /// <returns>Tournoi Model.</returns>
        public static TournoiModel fromTournoiContract(TournoiContract tournoiC)
        {
            if (tournoiC == null)
                return null;

            TournoiModel t = new TournoiModel();
            t.ID = tournoiC.ID;
            t.Nom = tournoiC.Nom;
            t.Matchs = MatchAdapter.fromMatchContractList(tournoiC.Matchs.ToList());

            return t;
        }
Exemplo n.º 3
0
        public ActionResult Bet(string Tournois)
        {
            ServiceClient   webService = new ServiceClient();
            TournoiContract tournoi    = webService.GetTournoi(int.Parse(Tournois));
            var             jedis      = tournoi.Matchs.Select(m => m.Jedi1).Union(tournoi.Matchs.Select(m => m.Jedi2));

            ViewBag.Tournoi = tournoi;
            ViewBag.Jedis   = jedis.Select(t => new SelectListItem {
                Text = t.Nom, Value = t.ID.ToString()
            });
            webService.Close();
            return(View());
        }
Exemplo n.º 4
0
        public static Tournoi TournoiContractToTournoi(TournoiContract t)
        {
            Tournoi tournoi = new Tournoi();

            tournoi.ID     = t.ID;
            tournoi.Nom    = t.Nom;
            tournoi.Matchs = new List <Match>();
            foreach (var m in t.Matchs)
            {
                tournoi.Matchs.Add(MatchAdapter.MatchContractToMatch(m));
            }

            return(tournoi);
        }
Exemplo n.º 5
0
 public void UpdateTournoi(TournoiContract tournoi)
 {
     jtm.UpdateTournoi(TournoiAdapter.TournoiContractToTournoi(tournoi));
 }
Exemplo n.º 6
0
 public void DelTournoi(TournoiContract tournoi)
 {
     jtm.DelTournoi(TournoiAdapter.TournoiContractToTournoi(tournoi));
 }
Exemplo n.º 7
0
        public TournoiContract AddTournoi(TournoiContract tournoi)
        {
            jtm.AddTournoi(TournoiAdapter.TournoiContractToTournoi(tournoi));

            return(tournoi);
        }