Example #1
0
        public DbResponse <AccountDepositCrudModel> Deposit(AccountDepositCrudModel model)
        {
            try
            {
                if (model.DepositAmount < 0)
                {
                    return(new DbResponse <AccountDepositCrudModel>(false, "Invalid Data"));
                }

                if (_db.Account.IsNull(model.AccountId))
                {
                    return(new DbResponse <AccountDepositCrudModel>(false, $"Account Not Found"));
                }

                _db.Account.BalanceAdd(model.AccountId, model.DepositAmount);

                return(_db.AccountDeposit.Add(model));
            }
            catch (Exception e)
            {
                return(new DbResponse <AccountDepositCrudModel>(false, $"{e.Message}. {e.InnerException?.Message ?? ""}"));
            }
        }
Example #2
0
        //Add
        public IActionResult AddDeposit(AccountDepositCrudModel model)
        {
            var response = _accountCore.Deposit(model);

            return(Json(response));
        }