Ejemplo n.º 1
0
 public ActionResult Edit([Bind(Include = "EmpId,Ename,Esalary,EmailId")] EmployeeModel employeeModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employeeModel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(employeeModel));
 }
 public ActionResult Edit([Bind(Include = "Id,EmpName,EmpSalary")] Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(employee));
 }
 public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,Gender,Salary,DepartmentId")] Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "Name", employee.DepartmentId);
     return(View(employee));
 }