Ejemplo n.º 1
0
        public ActionResult TransferSavingToChecking(TransferSToCModel tcs)
        {
            IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance();

            UserInfo ui = CookieFacade.USERINFO;

            try
            {
                if (ModelState.IsValid)
                {
                    bool ret = ibank.TransferSavingToChecking(ui.CheckingAcccountNumber, ui.SavingAccountNumber, tcs.Amount);
                    if (ret == true)
                    {
                        ViewBag.Message = "Transfer successful..";
                        ModelState.Clear();   // otherwise, textbox will display the old amount
                        tcs.Amount = 0;
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
            }
            tcs.CheckingBalance = ibank.GetCheckingBalance(ui.CheckingAcccountNumber);
            tcs.SavingBalance   = ibank.GetSavingBalance(ui.SavingAccountNumber);
            return(View(tcs));
        }
Ejemplo n.º 2
0
 public IActionResult OnPost()
 {
     if (SessionFacade.USERINFO == null) // not logged in
     {
         return(RedirectToPage("/Account/Login", new { area = "Identity" }));
     }
     else
     {
         UserInfo userInfo = SessionFacade.USERINFO;
         bool     res      = _ibusbank.TransferSavingToChecking(userInfo.SavingAccountNumber, userInfo.CheckingAccountNumber, TransferAmount);
         if (res)
         {
             CheckingBalance = _ibusbank.GetCheckingBalance(userInfo.CheckingAccountNumber);
             SavingBalance   = _ibusbank.GetSavingBalance(userInfo.SavingAccountNumber);
             Message         = "Transfer succeeded..";
             // clear history cache
             string key = String.Format("TRHISTORY_{0}", userInfo.CheckingAccountNumber);
             CacheAbstractionHelper.CABS.Remove(key);
         }
     }
     return(Page());
 }