public ActionResult DepositMoney(DepositViewModel model)
        {
            var _userLogic = new UserLogic();
            if (ModelState.IsValid)
            {

                var deposit = new vault_depositits()
                                           {
                                               usr_det_id = _userLogic.GetUserIdByUserName(HttpContext.User.Identity.Name),
                                               vau_dep_timestamp = DateTime.Now,
                                               vau_dep_amount = model.Amount,
                                           };

                bool success = new DepositLogic().SaveDeposit(deposit);
                if (success)
                {
                    model.Message = "Success!";
                }
                else
                {
                    model.Message = "Error!";
                }
            }
            ModelState.Clear();
            model.Balance = _userLogic.GetBalanceByUserId(_userLogic.GetUserIdByUserName(HttpContext.User.Identity.Name)).ToString("N");
            return View(model);
        }
 public decimal GetBalanceByUserId(int userId)
 {
     decimal depositTotal = 0;
     decimal withdrawTotal = 0;
     List<vault_depositits> deposits = new DepositLogic().GetDepositsByUserId(userId).ToList();
     foreach (var deposit in deposits)
     {
         depositTotal += deposit.vau_dep_amount;
     }
     List<vault_withdraws> withdraws = new WithdrawLogic().GetWithdrawsByUserId(userId).ToList();
     foreach (var withdraw in withdraws)
     {
         withdrawTotal += withdraw.vau_wit_amount;
     }
     return depositTotal - withdrawTotal;
 }
 public DepositTests()
 {
     _depRepo = new DepositRepository();
     _depLogic = new DepositLogic();
 }