示例#1
0
        public void Update(tblStudent oStudent)
        {
            try
            {
                using (var ctx = new CRUDSampleEntities())
                {
                    ctx.tblContactDetails.Attach(oStudent.tblContactDetail);
                    ctx.Entry(oStudent.tblContactDetail).State = EntityState.Modified;

                    ctx.tblStudents.Attach(oStudent);
                    ctx.Entry(oStudent).State = EntityState.Modified;

                    ctx.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
 public void Update(tblCatalog oCatalog)
 {
     try
     {
         using (var ctx = new CRUDSampleEntities())
         {
             ctx.Entry(oCatalog).State = EntityState.Modified;
             ctx.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }