Example #1
0
 public ActionResult Create(emolyee Employee)
 {
     if (ModelState.IsValid)
     {
         db.emolyee.Add(Employee);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(Employee));
 }
Example #2
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));
         }
     }
 }