コード例 #1
0
 public IActionResult Insert(InsertViewModel viewmodel)
 {
     if (ModelState.IsValid)
     {
         _InsertService.CreateAnInsert(viewmodel.AccountID, viewmodel.Operation, viewmodel.Amount, viewmodel.Symbol, viewmodel.Bank, viewmodel.Account);
         return(RedirectToAction("ViewAccount", "Account", new { id = viewmodel.AccountID }));
     }
     return(View(viewmodel));
 }
コード例 #2
0
        public bool CreateTransfer(int accountid, bool credit, string operation, decimal amount, string symbol, string otheraccount)
        {
            if (credit)
            {
                if (AmountShouldNotBeGreaterThenExisting(accountid, amount, true, otheraccount))
                {
                    _withdrawService.CreateWithdraw(Int32.Parse(otheraccount), operation, amount, symbol, "This Bank",
                                                    accountid.ToString());
                    _insertService.CreateAnInsert(accountid, operation, amount, symbol, "This Bank", otheraccount);
                    return(true);
                }
            }
            else
            {
                if (AmountShouldNotBeGreaterThenExisting(accountid, amount, false, otheraccount))
                {
                    _withdrawService.CreateWithdraw(accountid, operation, amount, symbol, "This Bank", otheraccount);
                    _insertService.CreateAnInsert(Int32.Parse(otheraccount), operation, amount, symbol, "This Bank", accountid.ToString());
                    return(true);
                }
            }

            return(false);
        }