Example #1
0
        public bool Foto_Update(Fotograflar user)
        {
            using (TIYATROEntities te = new TIYATROEntities())
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    try
                    {
                        Fotograflar fotolar = te.Fotograflar.FirstOrDefault(f => f.FotoId == user.FotoId);

                        fotolar.FotoId   = user.FotoId;
                        fotolar.FotoAdi  = user.FotoAdi;
                        fotolar.FotoLink = user.FotoLink;
                        fotolar.OyunNo   = user.OyunNo;

                        te.SaveChanges();
                        scope.Complete();
                        return(true);
                    }
                    catch (Exception)
                    {
                        scope.Dispose();
                        return(false);
                    }
                }
            }
        }
Example #2
0
        public bool Foto_Insert(Fotograflar user)
        {
            using (TIYATROEntities te = new TIYATROEntities())
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    try
                    {
                        Fotograflar foto = new Fotograflar();

                        foto.FotoId   = user.FotoId;
                        foto.FotoAdi  = user.FotoAdi;
                        foto.FotoLink = user.FotoLink;
                        foto.OyunNo   = user.OyunNo;

                        te.Fotograflar.Add(foto);
                        te.SaveChanges();
                        scope.Complete();
                        return(true);
                    }
                    catch (Exception)
                    {
                        scope.Dispose();
                        return(false);
                    }
                }
            }
        }
Example #3
0
        public bool Foto_Delete(Fotograflar user)
        {
            using (TIYATROEntities te = new TIYATROEntities())
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    try
                    {
                        Fotograflar fotolar = te.Fotograflar.FirstOrDefault(f => f.FotoId == user.FotoId);

                        te.Fotograflar.Remove(fotolar);
                        te.SaveChanges();
                        scope.Complete();
                        return(true);
                    }
                    catch (Exception)
                    {
                        scope.Dispose();
                        return(false);
                    }
                }
            }
        }