Beispiel #1
0
 public static void Delete(int?id)
 {
     using (dbAgroFlorEntities db = new dbAgroFlorEntities())
     {
         using (var transaction = db.Database.BeginTransaction())
         {
             try
             {
                 config alumno = db.config.Find(id);
                 db.Entry(alumno).State = System.Data.Entity.EntityState.Deleted;
                 db.SaveChanges();
                 transaction.Commit();
             }
             catch (Exception ex)
             {
                 transaction.Rollback();
                 throw ex;
             }
         }
     }
 }
Beispiel #2
0
 public static void Update(config c)
 {
     using (dbAgroFlorEntities db = new dbAgroFlorEntities())
     {
         using (var transaction = db.Database.BeginTransaction())
         {
             try
             {
                 db.config.Attach(c);
                 db.Entry(c).State = System.Data.Entity.EntityState.Modified;
                 db.SaveChanges();
                 transaction.Commit();
             }
             catch (Exception ex)
             {
                 transaction.Rollback();
                 throw ex;
             }
         }
     }
 }