public ActionResult Edit([Bind(Include = "Eid,Ename,ESal,EGen,EDOB,Did")] Employee employee) { if (ModelState.IsValid) { db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Did = new SelectList(db.Departments, "Did", "Dname", employee.Did); return(View(employee)); }
protected internal bool Update(int id, Employee emp) { try { OE.Entry(emp).State = EntityState.Modified; OE.SaveChanges(); return(true); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(id)) { return(false); } else { throw; } } }