Beispiel #1
0
 public bool ilce_Delete(Ilce usr)
 {
     try
     {
         using (TransactionScope ts = new TransactionScope())
         {
             using (SobelediyeEntities sb = new SobelediyeEntities())
             {
                 Ilce ilce = sb.Ilce.FirstOrDefault(x => x.Ilce_ID == usr.Ilce_ID);
                 sb.Ilce.Remove(ilce);
                 sb.SaveChanges();
                 ts.Complete();
             }
         }
     }
     catch
     {
         return(false);
     }
     return(true);
 }
Beispiel #2
0
 public bool ilce_Update(Ilce usr)
 {
     try
     {
         using (TransactionScope ts = new TransactionScope())
         {
             using (SobelediyeEntities sb = new SobelediyeEntities())
             {
                 Ilce ilce = sb.Ilce.First(x => x.Ilce_ID == usr.Ilce_ID);
                 ilce.Ilce1 = "degisik";
                 sb.SaveChanges();
                 ts.Complete();
             }
         }
     }
     catch
     {
         return(false);
     }
     return(true);
 }
Beispiel #3
0
 public bool ilce_Insert(Ilce usr)
 {
     try
     {
         using (TransactionScope ts = new TransactionScope()) //linq ile where primary key'de sql transaction (türleri) scope transaction türleri read commit dirty data darboğaz nedir kullandığın transaction scope'u bil
         {
             using (SobelediyeEntities sb = new SobelediyeEntities())
             {
                 Ilce ilce = new Ilce();
                 ilce.Ilce1   = usr.Ilce1;
                 ilce.IlID    = usr.IlID;
                 ilce.Ilce_ID = usr.Ilce_ID;
                 sb.Ilce.Add(ilce);
                 sb.SaveChanges();
                 ts.Complete();
             }
         }
     }
     catch (SystemException ex)
     {
         return(false);
     }
     return(true);
 }