Ejemplo n.º 1
0
 public ActionResult AddOrEdit(User userModel)
 {
     using (ProductChimiqueEntities1 dbModel = new ProductChimiqueEntities1())
     {
         if (dbModel.Users.Any(x => x.Username == userModel.Username))
         {
             ViewBag.DuplicateMessage = "Produict Already Existed";
             return(View("AjoutProduit", userModel));
         }
         dbModel.Users.Add(userModel);
         dbModel.SaveChanges();
     }
     ModelState.Clear();
     ViewBag.SuccessMessage = "Registation Sucessful";
     return(View("AjoutUsers", new User()));
 }