Пример #1
0
        public void Update(int userId, decimal cash, bool debitar = false)
        {
            try
            {
                using (IDAOWallet daoWallet = new DAOWallet())
                {
                    Wallet wallet = daoWallet.GetSingle(x => x.UserId == userId);

                    if (debitar)
                    {
                        wallet.Money -= cash;
                    }
                    else
                    {
                        wallet.Money += cash;
                    }

                    daoWallet.Update(wallet);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #2
0
        public WalletModel Select(int userId)
        {
            using (IDAOWallet daoUser = new DAOWallet())
            {
                Wallet wallet = daoUser.GetSingle(x => x.UserId == userId);

                if (wallet != null)
                {
                    return(this.WalletToModel(wallet));
                }
            }

            return(null);
        }