Пример #1
0
        public IActionResult Create(RegionViewModels regionModel)
        {
            RegionContext regionContext = new RegionContext(connectionString);

            regionModel.Region = regions();

            IActionResult retour = null;

            if (ModelState.IsValid)
            {
                Region region = new Region();

                region.Identifiant = regionModel.Identifiant;
                region.Nom         = regionModel.Nom;



                bool isOK = regionContext.Insert(region);
                retour = RedirectToAction("Index");
            }
            else
            {
                retour = View(regionModel);
            }

            return(retour);
        }