public ActionResult Withdraw(usp_view_account_by_accountid_Result acc_details, FormCollection formobj) { decimal old_bal = Convert.ToDecimal(TempData["old_bal"]); decimal amount = Convert.ToInt32(Request.Form["amt"]); if (old_bal < amount) { TempData["notice"] = "Your acccount dont have sufficient balance"; //pop up .. not sufficient balance...withdrawal amount is more than balance //return RedirectToAction("ViewAll"); return(View()); } else { dbo.usp_withdrawmoney_by_accountid(Convert.ToInt32(acc_details.AccountId), amount); this.dbo.SaveChanges(); int n1 = dbo.usp_insert_transaction_details(acc_details.AccountId, amount, "Debited"); this.dbo.SaveChanges(); acc_details = dbo.usp_view_account_by_accountid(acc_details.AccountId).FirstOrDefault(); //pop up success with updated balance as acc_details.Balance //return RedirectToAction("ViewAll"); TempData["notice"] = "Withdraw Successful. Current Balance:" + acc_details.Balance; return(View()); } }
//withdraw starts here public ActionResult Withdraw(long?id) { usp_view_account_by_accountid_Result acc_details = new usp_view_account_by_accountid_Result(); acc_details = dbo.usp_view_account_by_accountid(id).FirstOrDefault(); if (acc_details.Status == "Inactive") { //pop for inactive account i.e not exists return(RedirectToAction("ViewAll")); } TempData["old_bal"] = acc_details.Balance; return(View(acc_details)); }
public ActionResult Deposit(usp_view_account_by_accountid_Result acc_details, FormCollection formobj) { int amount = Convert.ToInt32(Request.Form["amt"]); //new balnce is not working...instead i am viewing by id decimal new_bal = dbo.usp_addmoney_by_accountid(Convert.ToInt32(acc_details.AccountId), amount); this.dbo.SaveChanges(); //for pop up use these acc_details = dbo.usp_view_account_by_accountid(acc_details.AccountId).FirstOrDefault(); //use acc_details.balance for pop up of new balance return(RedirectToAction("ViewAll")); }
//deposit starts here public ActionResult Deposit(long?id) { usp_view_account_by_accountid_Result acc_details = new usp_view_account_by_accountid_Result(); acc_details = dbo.usp_view_account_by_accountid(id).FirstOrDefault(); if (acc_details.Status == "Inactive") { //pop up this accoint does not exists....inactive return(RedirectToAction("ViewAll")); } return(View(acc_details)); }
public ActionResult ConfirmDelete(usp_view_account_by_accountid_Result objAccount) { int result = db.usp_delete_account_by_accountid(objAccount.AccountId); if (result == -1) { TempData["notice"] = "Account cannot be deleted as it has some balance"; return(View()); } else { this.db.SaveChanges(); return(RedirectToAction("AccountList")); } }
public ActionResult Deposit(usp_view_account_by_accountid_Result acc_details, FormCollection formobj) { decimal amount = Convert.ToInt32(Request.Form["amt"]); //new balnce is not working...instead i am viewing by id decimal new_bal = dbo.usp_addmoney_by_accountid(Convert.ToInt32(acc_details.AccountId), amount); this.dbo.SaveChanges(); int n1 = dbo.usp_insert_transaction_details(acc_details.AccountId, amount, "Credited"); this.dbo.SaveChanges(); //for pop up use these acc_details = dbo.usp_view_account_by_accountid(acc_details.AccountId).FirstOrDefault(); //use acc_details.balance for pop up of new balance TempData["notice"] = "Deposit Successful. Current Balance:" + acc_details.Balance; return(View()); }
public ActionResult ConfirmDelete() { long id = Convert.ToInt64(TempData["id"]); usp_view_account_by_accountid_Result acc = new usp_view_account_by_accountid_Result(); acc = db.usp_view_account_by_accountid(id).FirstOrDefault(); return(View(acc)); //int result = db.usp_delete_account_by_accountid(id); //if (result == -1) //{ // return RedirectToAction("DeleteAccount"); //} //else //{ // this.db.SaveChanges(); // return View(objAccount); //} }
public ActionResult Withdraw(usp_view_account_by_accountid_Result acc_details, FormCollection formobj) { decimal old_bal = Convert.ToDecimal(TempData["old_bal"]); int amount = Convert.ToInt32(Request.Form["amt"]); if (old_bal < amount) { //pop up .. not sufficient balance...withdrawal amount is more than balance return(RedirectToAction("ViewAll")); } else { dbo.usp_withdrawmoney_by_accountid(Convert.ToInt32(acc_details.AccountId), amount); this.dbo.SaveChanges(); acc_details = dbo.usp_view_account_by_accountid(acc_details.AccountId).FirstOrDefault(); //pop up success with updated balance as acc_details.Balance return(RedirectToAction("ViewAll")); } }
//withdraw starts here public ActionResult Withdraw(long?id) { if (Convert.ToInt32(Session["role_id"]) == 2) { usp_view_account_by_accountid_Result acc_details = new usp_view_account_by_accountid_Result(); acc_details = dbo.usp_view_account_by_accountid(id).FirstOrDefault(); if (acc_details.Status == "Inactive") { TempData["notice"] = "Account does not exist"; return(View()); //pop for inactive account i.e not exists //return RedirectToAction("ViewAll"); } TempData["old_bal"] = acc_details.Balance; return(View(acc_details)); } else { return(RedirectToAction("Login", "Login")); } }
//deposit starts here public ActionResult Deposit(long?id) { if (Convert.ToInt32(Session["role_id"]) == 2) { usp_view_account_by_accountid_Result acc_details = new usp_view_account_by_accountid_Result(); acc_details = dbo.usp_view_account_by_accountid(id).FirstOrDefault(); if (acc_details.Status == "Inactive" || acc_details == null) { TempData["notice"] = "Account does not exist"; return(View()); //pop up this accoint does not exists....inactive //return RedirectToAction("ViewAll"); } return(View(acc_details)); } else { return(RedirectToAction("Login", "Login")); } }