Beispiel #1
0
        // GET

        public IActionResult Index()
        {
            IEnumerable <Models.Proprietaire> list = Context.Proprietaires.ToList();
            PropriAll data = new PropriAll()
            {
                ListPropri = list
            };

            return(View(data));
        }
Beispiel #2
0
        public IActionResult Index(PropriAll propriAll)
        {
            if (ModelState.IsValid)
            {
                Models.Proprietaire data = new Models.Proprietaire()
                {
                    id        = Generators.PolyIdGenerator(10),
                    adresse   = propriAll.Apropri.adresse,
                    nom       = propriAll.Apropri.nom,
                    prenom    = propriAll.Apropri.prenom,
                    telephone = propriAll.Apropri.telephone
                };
                Context.Proprietaires.Add(data);
                Context.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(RedirectToAction("Index"));
        }