Пример #1
0
        public bool Tiyatro_Update(Tiyatrolar user)
        {
            using (TIYATROEntities te = new TIYATROEntities())
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    try
                    {
                        Tiyatrolar tiyatro = te.Tiyatrolar.FirstOrDefault(f => f.TiyatroID == user.TiyatroID);

                        tiyatro.TiyatroID  = user.TiyatroID;
                        tiyatro.TiyatroAdi = user.TiyatroAdi;
                        tiyatro.AdresID    = user.AdresID;

                        te.SaveChanges();
                        scope.Complete();
                    }
                    catch (Exception)
                    {
                        scope.Dispose();
                    }
                }
            }
            return(true);
        }
Пример #2
0
        public bool Tiyatro_Insert(Tiyatrolar user)
        {
            using (TIYATROEntities te = new TIYATROEntities())
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    try
                    {
                        Tiyatrolar tytr = new Tiyatrolar();

                        tytr.TiyatroID  = user.TiyatroID;
                        tytr.TiyatroAdi = user.TiyatroAdi;
                        tytr.AdresID    = user.AdresID;

                        te.Tiyatrolar.Add(tytr);
                        te.SaveChanges();
                        scope.Complete();
                    }
                    catch (Exception)
                    {
                        scope.Dispose();
                        return(false);
                    }
                }
            }
            return(true);
        }