public ActionResult EditPost(int id)
 {
     Employee employee = new Employee();
     TryUpdateModel(employee);
     if (ModelState.IsValid)
     {
         EmployeebusinessLayer objbus = new EmployeebusinessLayer();
         objbus.updateEmployee(employee);
         return RedirectToAction("Index");
     }
     else
     {
         return RedirectToAction("Edit");
     }
 }
 public void AddEmployee(Employee employee)
 {
     string cn = ConfigurationManager.ConnectionStrings["dbcon"].ConnectionString;
         using (SqlConnection con = new SqlConnection(cn))
         {
             SqlCommand cmd = new SqlCommand("spAddEmployee",con);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Name", employee.Name);
             cmd.Parameters.AddWithValue("@Gender", employee.Gender);
             cmd.Parameters.AddWithValue("@City", employee.City);
             cmd.Parameters.AddWithValue("@DateOfBirth", employee.DateOfBirth);
             con.Open();
             cmd.ExecuteNonQuery();
         }
 }
 public ActionResult CreateEmployee()
 {
     if (ModelState.IsValid)
     {
         Employee employee = new Employee();
         UpdateModel(employee);
         EmployeebusinessLayer objbus = new EmployeebusinessLayer();
         objbus.AddEmployee(employee);
         return RedirectToAction("Index");
     }
     else
     {
         return View();
     }
 }