public static BHXH.Data.ListTDQLNN New(string MaTDQLNN, string TenTDQLNN) { if (MaTDQLNN == "" || TenTDQLNN == "") { return(null); } if (IsExisted(MaTDQLNN, TenTDQLNN) != null) { return(IsExisted(MaTDQLNN, TenTDQLNN)); } BHXH.Data.BHXHEntities ctx = new Data.BHXHEntities(); BHXH.Data.ListTDQLNN n = new Data.ListTDQLNN(); n.MaTDQLNN = MaTDQLNN; n.TenTDQLNN = TenTDQLNN; ctx.ListTDQLNN.Add(n); try { ctx.SaveChanges(); ctx.Dispose(); return(n); } catch (Exception) { return(null); } finally { } }
public static void Delete(string MaTDQLNN) { BHXH.Data.BHXHEntities ctx = new Data.BHXHEntities(); var obj = new Data.ListTDQLNN { MaTDQLNN = MaTDQLNN }; ctx.ListTDQLNN.Attach(obj); ctx.ListTDQLNN.Remove(obj); ctx.SaveChanges(); }