示例#1
0
        public ActionResult Ajouter(Client client)
        {
            using (var dal = new ClientDal())
            {
                if (dal.Existe(client.Nom, client.Prenom))
                {
                    ViewBag.MessageErreur = "Ce client existe déjà";
                    ModelState.AddModelError("Client", "Ce client existe déjà");
                }
                if (!ModelState.IsValid)
                {
                    return(View(client));
                }

                dal.Add(client.Nom, client.Prenom, client.Email);

                return(RedirectToAction("Index"));
            }
        }