public bool Update(EmpModel model) { try { var emp = _db.Employees.Find(model.empId); if (emp != null) { emp.address = model.address; emp.age = model.age; emp.birthdate = model.birthdate; emp.email = model.email; emp.fName = model.fName; emp.gender = model.gender; emp.hobby = model.hobby; emp.lName = model.lName; emp.mName = model.mName; } _db.Entry(emp).State = System.Data.Entity.EntityState.Modified; _db.SaveChanges(); return(true); } catch (Exception exp) { } return(false); }
public bool Update(SalaryModel model) { try { var sal = _db.Salaries.Find(model.salaryId); if (sal != null) { sal.date = model.date; sal.sal = model.sal; sal.empId = model.empId; } _db.Entry(sal).State = System.Data.Entity.EntityState.Modified; _db.SaveChanges(); return(true); } catch (Exception exp) { } return(false); }