public static void DeleteConfig(Config c) { using (var ctx = new BMIKidsEntities(BaseDataProvider.ConnectionString)) { try { c.MarkAsDeleted(); ctx.Configs.ApplyChanges(c); ctx.SaveChanges(); c.AcceptChanges(); } catch (Exception ex) { if (ex.InnerException != null) throw ex.InnerException; throw; } } }
public static void SaveConfig(Config c) { using (var ctx = new BMIKidsEntities(BaseDataProvider.ConnectionString)) { try { if (c.ChangeTracker.State == ObjectState.Unchanged) c.MarkAsModified(); ctx.Configs.ApplyChanges(c); ctx.SaveChanges(); c.AcceptChanges(); } catch (Exception ex) { if (ex.InnerException != null) throw ex.InnerException; throw; } } }