public void Delemp(empTbl empData) { using (empDBEntities emp = new empDBEntities()) { EmpTbl empDel = emp.EmpTbls.Where(x => x.Id == empData.Id).FirstOrDefault(); emp.EmpTbls.Remove(empDel); emp.SaveChanges(); } }
public void UpdateEmp(empTbl empData) { using (empDBEntities emp = new empDBEntities()) { EmpTbl etbl = emp.EmpTbls.Where(x => x.Id == empData.Id).FirstOrDefault(); etbl.empName = empData.empName; etbl.empAge = empData.empAge; etbl.empSalary = Convert.ToDecimal(empData.empSalary); etbl.deptId = empData.deptId; emp.SaveChanges(); } }
public void AddEmp(empTbl empData) { using (empDBEntities emp = new empDBEntities()) { EmpTbl etbl = new EmpTbl(); etbl.empName = empData.empName; etbl.empAge = empData.empAge; etbl.empSalary = Convert.ToDecimal(empData.empSalary); etbl.deptId = empData.deptId; emp.EmpTbls.Add(etbl); emp.SaveChanges(); } }