예제 #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);
        }