Beispiel #1
0
        public static Stade StadeContractToStade(StadeContract s)
        {
            Stade stade = new Stade();

            stade.ID       = s.ID;
            stade.NbPlaces = s.NbPlaces;
            stade.Planete  = s.Planete;
            return(stade);
        }
        public ActionResult Delete(int id, StadeContract stade)
        {
            ServiceClient webService = new ServiceClient();
            try
            {
                webService.DelStades(stade);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        public ActionResult Delete(int id, StadeContract stade)
        {
            ServiceClient webService = new ServiceClient();

            try
            {
                webService.DelStades(stade);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create(StadeContract stade)
        {
            ServiceClient webService = new ServiceClient();

            try
            {
                webService.AddStades(stade);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create(StadeContract stade)
        {
            ServiceClient webService = new ServiceClient();

            try
            {
                webService.AddStades(stade);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        /// <summary>
        /// Adapte un Stade Model en Stade Contract.
        /// </summary>
        /// <param name="stade">Stade à adapter.</param>
        /// <returns>Stade contract.</returns>
        public static StadeContract fromStadeModel(StadeModel stade)
        {
            if (stade == null)
                return null;

            StadeContract sc = new StadeContract();
            sc.ID = stade.ID;
            sc.Nom = stade.Nom;
            sc.NbPlaces = stade.NbPlaces;
            sc.Planete = stade.Planete;

            if (stade.Caracteristiques == null)
                stade.Caracteristiques = new List<CaracteristiqueModel>();

            sc.Caracteristiques = CaracteristiqueAdapter.fromCaracteristiqueModelList(stade.Caracteristiques).ToArray();

            return sc;
        }
        /// <summary>
        /// Adapte un Stade Contract en Stade Model.
        /// </summary>
        /// <param name="stadeC">Stade Contract à adapter.</param>
        /// <returns>Stade Model.</returns>
        public static StadeModel fromStadeContract(StadeContract stadeC)
        {
            if (stadeC == null)
                return null;

            StadeModel s = new StadeModel();
            s.ID = stadeC.ID;
            s.Nom = stadeC.Nom;
            s.NbPlaces = stadeC.NbPlaces;
            s.Planete = stadeC.Planete;

            if (stadeC.Caracteristiques == null)
                stadeC.Caracteristiques = new CaracteristiqueContract[0];

            s.Caracteristiques = CaracteristiqueAdapter.fromCaracteristiqueContractList(stadeC.Caracteristiques.ToList());

            return s;
        }
Beispiel #8
0
 public void DelStades(StadeContract sta)
 {
     jtm.DelStade(StadeAdapter.StadeContractToStade(sta));
 }
Beispiel #9
0
 public StadeContract AddStades(StadeContract sta)
 {
     jtm.AddStade(StadeAdapter.StadeContractToStade(sta));
     return(sta);
 }
Beispiel #10
0
 public void UpdateStades(StadeContract sta)
 {
     jtm.UpdateStade(StadeAdapter.StadeContractToStade(sta));
 }