Example #1
0
 public ActionResult Index(Registration userModel)
 {
     using (employeeContextEntites db = new employeeContextEntites())
     {
         if (ModelState.IsValid)
         {
             try
             {
                 db.Registration.Add(userModel);
                 db.SaveChanges();
             }
             catch (DbEntityValidationException e)
             {
                 Console.WriteLine(e);
             }
             return(RedirectToAction("Index", "Login"));
         }
         else
         {
             return(View(userModel));
         }
     }
 }