コード例 #1
0
        public bool KullaniciTuru_Update(KullaniciTuru user)
        {
            using (TIYATROEntities te = new TIYATROEntities())
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    try
                    {
                        KullaniciTuru kTuru = te.KullaniciTuru.FirstOrDefault(f => f.TurId == user.TurId);

                        kTuru.TurId        = user.TurId;
                        kTuru.IndirimOrani = user.IndirimOrani;
                        kTuru.TurAdi       = user.TurAdi;

                        te.SaveChanges();
                        scope.Complete();
                    }
                    catch (Exception)
                    {
                        scope.Dispose();
                    }
                }
            }
            return(true);
        }
コード例 #2
0
        public bool KullaniciTuru_Insert(KullaniciTuru user)
        {
            using (TIYATROEntities te = new TIYATROEntities())
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    try
                    {
                        KullaniciTuru ktur = new KullaniciTuru();

                        ktur.TurId        = user.TurId;
                        ktur.IndirimOrani = user.IndirimOrani;
                        ktur.TurAdi       = user.TurAdi;

                        te.KullaniciTuru.Add(ktur);
                        te.SaveChanges();
                        scope.Complete();
                    }
                    catch (Exception)
                    {
                        scope.Dispose();
                    }
                }
            }
            return(true);
        }