示例#1
0
 public void AddEmployee(tbl_employee emp)
 {
     using (var dbCtx = new DXCDBEntities())
     {
         dbCtx.tbl_employee.Add(emp);
         dbCtx.SaveChanges();
     }
 }
示例#2
0
 public List <tbl_employee> GetAllEmps()
 {
     using (var dbCtx = new  DXCDBEntities())
     {
         var lstEmps = dbCtx.tbl_employee.ToList();
         return(lstEmps);
     }
 }
示例#3
0
 public tbl_employee GetEmpById(int id)
 {
     using (var dbCtx = new DXCDBEntities())
     {
         var record = dbCtx.tbl_employee
                      .Where(o => o.ecode == id)
                      .SingleOrDefault();
         return(record);
     }
 }
示例#4
0
        public void DeleteEmpIById(int ecode)
        {
            using (var dbCtx = new  DXCDBEntities())
            {
                var record = dbCtx.tbl_employee
                             .Where(o => o.ecode == ecode)
                             .SingleOrDefault();

                dbCtx.tbl_employee.Remove(record);
                dbCtx.SaveChanges();
            }
        }
示例#5
0
        public void UpdateEmp(tbl_employee emp)
        {
            using (var dbCtx = new  DXCDBEntities())
            {
                var record = dbCtx.tbl_employee
                             .Where(o => o.ecode == emp.ecode)
                             .SingleOrDefault();

                record.ename  = emp.ename;
                record.salary = emp.salary;
                record.deptid = emp.deptid;

                dbCtx.SaveChanges();
            }
        }