public ViewResult AddTranscation(TranscationEnties te) { if (Session["user"] != null) { TranscationBL tb = new TranscationBL(); int res = tb.AddTranscation(te); if (res > 0) { ViewData["a"] = "Transcation Success full"; } else { ViewData["a"] = "Inavalid Transcation"; } return(View()); } else { return(View()); } }
public int AddTranscation(TranscationEnties te) { return(ts.AddTranscation(te)); }
public int AddTranscation(TranscationEnties te) { db = new MphasisBankEntities(); var res = db.SavingsAccounts.Where(t => t.Accountid == te.Accountid); if (res.Count() > 0) { if (te.TranscationType == "Withdraw") { foreach (var item in res) { if (item.Balance < 0 || item.Balance < te.Balance) { d = 0; } else { Transcation t = new Transcation() { Accountid = te.Accountid, TranscationType = te.TranscationType, TranscationDate = DateTime.Now, Balance = te.Balance }; db.Transcations.Add(t); item.Balance -= te.Balance; d = 1; } } if (d == 1) { SavingsAccount sa = new SavingsAccount() { Balance = te.Balance }; db.SaveChanges(); } return(1); } else if (te.TranscationType == "Deposite") { foreach (var item in res) { if (item.Balance < 0 || item.Balance < te.Balance) { d = 0; } else { Transcation t = new Transcation() { Accountid = te.Accountid, TranscationType = te.TranscationType, TranscationDate = DateTime.Now, Balance = te.Balance }; db.Transcations.Add(t); item.Balance += te.Balance; d = 1; } } if (d == 1) { SavingsAccount sa = new SavingsAccount() { Balance = te.Balance }; db.SaveChanges(); } return(1); } else { return(0); } } else { return(0); } }
public TranscationEnties ViewTrans(DateTime StartDate, DateTime EndDate) { TranscationEnties te = new TranscationEnties(); return(te); }