Пример #1
0
        public static BHXH.Data.ListTDLLCT New(string MaTDLLCT, string TenTDLLCT)
           
        {
            if (MaTDLLCT == "" || TenTDLLCT == "")
                return null;
            if (IsExisted(MaTDLLCT, TenTDLLCT) != null)
                return IsExisted(MaTDLLCT, TenTDLLCT);
              BHXH.Data.BHXHEntities ctx = new Data.BHXHEntities();
            BHXH.Data.ListTDLLCT n = new Data.ListTDLLCT();
            n.MaTDLLCT = MaTDLLCT;
            n.TenTDLLCT = TenTDLLCT;
            ctx.ListTDLLCT.Add(n);

            try
            {
                ctx.SaveChanges();
                return n;
            }
            catch (Exception)
            {
                return null;
            }

            finally
            { }



        }
Пример #2
0
        public static void Delete(string MaTDLLCT)
        {
            BHXH.Data.BHXHEntities ctx = new Data.BHXHEntities();

            var obj = new Data.ListTDLLCT { MaTDLLCT = MaTDLLCT };
            ctx.ListTDLLCT.Attach(obj);
            ctx.ListTDLLCT.Remove(obj);

            ctx.SaveChanges();


        }