예제 #1
0
        public ActionResult AjouterEnfant(int id, PersonneAjouterEnfant pae)
        {
            pae.idArbre = new PersonneServiceAPI().Donner(id).idArbre;

            if (ModelState.IsValid)
            {
                if (new PersonneServiceAPI().AjouterEnfant(new ParentEnfant {
                    idEnfant = pae.machin, idParent = id
                }))
                {
                    return(RedirectToAction("DonnerPourArbre", new { id = pae.idArbre }));
                }
            }
            return(View(pae));
        }
예제 #2
0
        public ActionResult AjouterEnfant(int id)
        {
            /* préparer la liste des enfants impossibles */
            Personne p = new PersonneServiceAPI().Donner(id);

            IList <SelectListItem> enfants = new PersonneServiceAPI().DonnerParenteesDirectesPossibles(id)
                                             .Where(u => ((p.homme && u.idPere == null) || (!p.homme && u.idMere == null)) && u.id != p.id)
                                             .Select(j => new SelectListItem {
                Selected = false, Value = j.id.ToString(), Text = j.VersAffichage()
            })
                                             .ToList();

            ;
            PersonneAjouterEnfant pae = new PersonneAjouterEnfant();

            pae.Parent  = new PersonneServiceAPI().Donner(id).VersAffichage();
            pae.enfants = enfants;
            pae.idArbre = p.idArbre;
            pae.id      = p.id;

            return(View(pae));
        }