Exemple #1
0
        /// <summary>
        /// Transfers funds from one user account to another
        /// </summary>
        /// <param name="fromAcct">The id of the account to debit</param>
        /// <param name="toAcct">The id of the account to credit</param>
        /// <param name="amount">The amount to transfer</param>
        /// <returns></returns>
        public IActionResult DoTransfer(TransferPayModel model)
        {
            var map = HttpContext.Session.GetJsonObject <AccessRefMap <int> >("map");

            BankService.Transfer(map.GetDirectReference(model.FromAccount),
                                 map.GetDirectReference(model.ToAccount), model.Amount);
            HttpContext.Session.Remove("map");
            return(Redirect("~/account/Index"));
        }
Exemple #2
0
        /// <summary>
        /// Initializes the account transfer page.
        /// </summary>
        /// <returns></returns>
        public IActionResult Transfer()
        {
            AccessRefMap <int> map = new AccessRefMap <int>();
            var accts = BankService.GetAccounts(UserId);
            var model = new TransferPayModel(accts, map);

            HttpContext.Session.SetJsonObject("map", map);

            return(View(model));
        }