Example #1
0
 public void Update(it_log obj)
 {
     using (ittransactionlogEntities db = new ittransactionlogEntities())
     {
         db.it_log.Attach(obj);
         db.Entry(obj).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
Example #2
0
 public it_log Insert(it_log obj)
 {
     using (ittransactionlogEntities db = new ittransactionlogEntities())
     {
         db.it_log.Add(obj);
         db.SaveChanges();
         return(obj);
     }
 }
Example #3
0
        public void Delete(int id)
        {
            using (ittransactionlogEntities db = new ittransactionlogEntities())
            {
                //using (dbemployeeEntities db = new dbemployeeEntities())
                //{
                //    db.Database.ExecuteSqlCommand("UPDATE employee_info SET lastname = 'SQLTEST' WHERE empID = 19");
                //}

                var delete = (from l in db.it_log
                              where l.it_log_id.Equals(id)
                              select l).FirstOrDefault();

                db.it_log.Attach(delete);
                db.it_log.Remove(delete);
                db.SaveChanges();
            }
        }