Example #1
0
 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();
     }
 }
Example #2
0
        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();
            }
        }
Example #3
0
        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();
            }
        }