public ActionResult Edit(Hiren_Employee emp)
 {
     if (ModelState.IsValid)
     {
         using (var db = new Trainee2021Entities())
         {
             var empdata = db.Hiren_Employee.Where(a => a.id.Equals(emp.id)).FirstOrDefault();
             if (empdata != null)
             {
                 empdata.FirstName       = emp.FirstName;
                 empdata.LastName        = emp.LastName;
                 empdata.City            = emp.City;
                 empdata.MobileNumber    = emp.MobileNumber;
                 empdata.Gender          = emp.Gender;
                 empdata.DepartmentId    = emp.DepartmentId;
                 empdata.Email           = emp.Email;
                 empdata.Address         = emp.Address;
                 empdata.Age             = emp.Age;
                 empdata.Username        = emp.Username;
                 empdata.Password        = emp.Password;
                 empdata.ConfirmPassword = emp.ConfirmPassword;
             }
             db.Entry(empdata).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("index"));
         }
     }
     return(View());
 }
 public ActionResult Create(Hiren_Employee emp)
 {
     if (ModelState.IsValid)
     {
         using (var db = new Trainee2021Entities())
         {
             db.Hiren_Employee.Add(emp);
             db.SaveChanges();
             return(RedirectToAction("index"));
         }
     }
     return(View());
 }