Esempio n. 1
0
        public ActionResult Creer(int id)
        {
            PersonneCreation pc = new PersonneCreation();

            pc.idArbre = id;

            return(View(pc));
        }
Esempio n. 2
0
        /*public static Arbre VersArbre(this ArbreDetails e)
         * {if (e == null) { return null; }return new Arbre{id = e.id,nom = e.nom,description = e.description};}*/

        /*Personne*/
        public static Personne VersPersonne(this PersonneCreation e)
        {
            if (e == null)
            {
                return(null);
            }
            return(new Personne {
                dateDeDeces = e.dateDeDeces, homme = e.homme, idArbre = e.idArbre, dateDeNaissance = e.dateDeNaissance, nom = e.nom, prenom = e.prenom,
                dateAjout = DateTime.Now
            });
        }
Esempio n. 3
0
        public ActionResult Creer(PersonneCreation c)
        {
            if (ModelState.IsValid)
            {
                Personne p = c.VersPersonne();

                /* contrôle arbre */

                var x = SessionUtilisateur.arbres;
                if (SessionUtilisateur.arbres
                    .Where(j => j.id == p.idArbre)
                    .Count() == 1)
                {
                    int i = new PersonneServiceAPI().Creer(p);
                    if (i > 0)
                    {
                        return(RedirectToAction("DonnerPourArbre", new { id = c.idArbre }));
                    }
                }
            }
            return(View(c));
        }