public bool Transfer(string GonderenHesapNo, string AlanHesapNo, decimal Miktar) { try { Hesap GonderenHesap = null; Hesap AlanHesap = null; using (var repo = new HesapRepository()) { GonderenHesap = repo.HesapNoSec(GonderenHesapNo); if (GonderenHesap.Bakiye >= Miktar) { AlanHesap = repo.HesapNoSec(AlanHesapNo); repo.HesapNoBakiyeGuncelle(GonderenHesapNo, GonderenHesap.Bakiye - Miktar); repo.HesapNoBakiyeGuncelle(AlanHesapNo, AlanHesap.Bakiye + Miktar); return(true); } return(false); } } catch (Exception ex) { throw new Exception("HesapBusiness:HesapRepository:Seçme Hatası", ex); } }
public bool BorcOde(int AboneNo, string HesapNo) { var repo2 = new HesapRepository(); try { using (var repo = new OdemeRepository()) { Odeme o = repo.AboneNoSec(AboneNo); Hesap h = repo2.HesapNoSec(HesapNo); var bakiye = h.Bakiye; var borc = o.Borc; if (borc > 0 && borc <= bakiye) { bakiye -= borc; borc = 0; repo2.HesapBakiyeGuncelle(h.HesapID, bakiye); repo.BorcOde(AboneNo); return(true); } } return(false); } catch (Exception ex) { throw new Exception("OdemeBusiness:OdemeRepository:Ödeme Hatası", ex); } }