Example #1
0
 public string ConnectionDatabaseName()
 {
     using (Context.HesabimDatabaseContext db = new Context.HesabimDatabaseContext())
     {
         return(db.Database.Connection.Database);
     }
 }
Example #2
0
 public int Delete(Kategori selectedKategori)
 {
     ReturnValue = 0;
     using (Hesabım.Context.HesabimDatabaseContext db = new Context.HesabimDatabaseContext())
     {
         try
         {
             Entities.Kategori findedKategori = db.Kategoriler.Find(selectedKategori.Id);
             if (findedKategori != null)
             {
                 db.Kategoriler.Remove(findedKategori);
                 ReturnValue = db.SaveChanges();
             }
             else
             {
                 throw new Exception("Silmek istediğiniz kayıt database içerisinde bulunamadı.");
             }
         }
         catch (Exception exception)
         {
             throw exception;
         }
     }
     return(ReturnValue);
 }
Example #3
0
 public string ConnectionStringInfo()
 {
     using (Context.HesabimDatabaseContext db = new Context.HesabimDatabaseContext())
     {
         return(db.Database.Connection.ConnectionString);
     }
 }
Example #4
0
 public List <Gelir> GetAll()
 {
     using (Hesabım.Context.HesabimDatabaseContext db = new Context.HesabimDatabaseContext())
     {
         return(db.Gelirler.ToList());
     }
 }
Example #5
0
 public List <Kategori> GetAll()
 {
     using (Hesabım.Context.HesabimDatabaseContext db = new Context.HesabimDatabaseContext())
     {
         return(db.Kategoriler.ToList());
     }
 }
Example #6
0
 public int Add(Gelir Entity)
 {
     using (Hesabım.Context.HesabimDatabaseContext db = new Context.HesabimDatabaseContext())
     {
         db.Gelirler.Add(Entity);
         ReturnValue = db.SaveChanges();
     }
     return(ReturnValue);
 }
Example #7
0
 public int Delete(Gelir Entity)
 {
     using (Hesabım.Context.HesabimDatabaseContext db = new Context.HesabimDatabaseContext())
     {
         var result = db.Gelirler.Where(I => I.Id == Entity.Id).FirstOrDefault();
         if (result != null)
         {
             db.Gelirler.Remove(result);
             ReturnValue = db.SaveChanges();
         }
     }
     return(ReturnValue);
 }
Example #8
0
 public int Delete(Gider gider)
 {
     using (Hesabım.Context.HesabimDatabaseContext db = new Context.HesabimDatabaseContext())
     {
         var Entity = db.Giderler.Where(I => I.Id == gider.Id).FirstOrDefault();
         if (Entity != null)
         {
             db.Giderler.Remove(Entity);
             ReturnValue = db.SaveChanges();
         }
     }
     return(ReturnValue);
 }
Example #9
0
 public int Update(AltKategori updatedAltKategori)
 {
     ReturnValue = 0;
     using (Hesabım.Context.HesabimDatabaseContext db = new Context.HesabimDatabaseContext())
     {
         var entity = db.AltKategoriler.Where(I => I.Id == updatedAltKategori.Id).FirstOrDefault();
         if (entity != null)
         {
             entity.SubKategoriAdi = updatedAltKategori.SubKategoriAdi;
             ReturnValue           = db.SaveChanges();
         }
     }
     return(ReturnValue);
 }
Example #10
0
 public int Delete(AltKategori selectedAltKategori)
 {
     ReturnValue = 0;
     using (Hesabım.Context.HesabimDatabaseContext db = new Context.HesabimDatabaseContext())
     {
         var entity = db.AltKategoriler.Where(I => I.Id == selectedAltKategori.Id).FirstOrDefault();
         if (entity != null)
         {
             db.AltKategoriler.Remove(entity);
             ReturnValue = db.SaveChanges();
         }
     }
     return(ReturnValue);
 }
Example #11
0
 public int Add(AltKategori newAltKategori)
 {
     try
     {
         using (Hesabım.Context.HesabimDatabaseContext db = new Context.HesabimDatabaseContext())
         {
             db.AltKategoriler.Add(newAltKategori);
             return(db.SaveChanges());
         }
     }
     catch (Exception)
     {
         throw new Exception("Aynı isimde kayıt mevcut");
     }
 }
Example #12
0
 public int Update(Gelir gelir)
 {
     ReturnValue = 0;
     using (Hesabım.Context.HesabimDatabaseContext db = new Context.HesabimDatabaseContext())
     {
         var result = db.Gelirler.Where(I => I.Id == gelir.Id).FirstOrDefault();
         if (result != null)
         {
             result.KategoriAdi    = gelir.KategoriAdi;
             result.KayitTarihi    = gelir.KayitTarihi;
             result.Tutar          = gelir.Tutar;
             result.AltKategoriAdi = gelir.AltKategoriAdi;
             result.Aciklama       = gelir.Aciklama;
             ReturnValue           = db.SaveChanges();
         }
     }
     return(ReturnValue);
 }
Example #13
0
 public int Update(Kategori updatedKategori)
 {
     ReturnValue = 0;
     using (Hesabım.Context.HesabimDatabaseContext db = new Context.HesabimDatabaseContext())
     {
         try
         {
             Entities.Kategori findedKategori = db.Kategoriler.Find(updatedKategori.Id);
             if (findedKategori != null)
             {
                 findedKategori.KategoriAdi = updatedKategori.KategoriAdi;
             }
             ReturnValue = db.SaveChanges();
         }
         catch (Exception exception)
         {
             throw exception;
         }
     }
     return(ReturnValue);
 }
Example #14
0
 public int Add(Kategori newKategori)
 {
     ReturnValue = 0;
     using (Hesabım.Context.HesabimDatabaseContext db = new Context.HesabimDatabaseContext())
     {
         try
         {
             db.Kategoriler.Add(newKategori);
             ReturnValue = db.SaveChanges();
         }
         catch (System.Data.Entity.Infrastructure.DbUpdateException)
         {
             throw new Exception("Aynı isimde kayıt mevcuttur.");
         }
         catch (Exception exception)
         {
             throw exception;
         }
     }
     return(ReturnValue);
 }