Beispiel #1
0
 public void AddEmployee(tbl_employee emp)
 {
     using (var dbCtx = new ValtechDBEntities())
     {
         dbCtx.tbl_employee.Add(emp);
         dbCtx.SaveChanges();
     }
 }
Beispiel #2
0
 public List <tbl_employee> GetAllEmps()
 {
     using (var dbCtx = new ValtechDBEntities())
     {
         var result = dbCtx.tbl_employee.ToList();
         return(result);
     }
 }
Beispiel #3
0
 public void UpdateEmp(tbl_employee emp)
 {
     using (var dbCtx = new ValtechDBEntities())
     {
         var record = dbCtx.tbl_employee
                      .Where(o => o.Ecode == emp.Ecode)
                      .SingleOrDefault();
         //delete record
         record.salary = emp.salary;
         dbCtx.SaveChanges();
     }
 }
Beispiel #4
0
 public void DeleteById(int ecode)
 {
     using (var dbCtx = new ValtechDBEntities())
     {
         var record = dbCtx.tbl_employee
                      .Where(o => o.Ecode == ecode)
                      .SingleOrDefault();
         //delete record
         dbCtx.tbl_employee.Remove(record);
         dbCtx.SaveChanges();
     }
 }
Beispiel #5
0
        public tbl_employee GetEmpById(int ecode)
        {
            using (var dbCtx = new ValtechDBEntities())
            {
                var record = dbCtx.tbl_employee
                             .Where(o => o.Ecode == ecode)
                             .SingleOrDefault();

                return(record);

                dbCtx.SaveChanges();
            }
        }