Example #1
0
        public static bool SaveCurrentPaypalBitcoinInformation(Fund fund)
        {

            var dc = new ManagementContext();
            var funds = dc.Funds.Where(x => x.UserId == fund.UserId).FirstOrDefault();
            if (funds == null)
            {
                FundsForWriter f = new FundsForWriter();
                f.BitCoinId = fund.BitCoinId;
                f.PaypalAddress = fund.PaypalAddress;
                f.UserId = fund.UserId;
                dc.Funds.Add(f);
            }
            else
            {
                funds.PaypalAddress = fund.PaypalAddress;
                funds.BitCoinId = fund.BitCoinId;
            }
            int c = dc.SaveChanges();

            return c > 0;
        }
Example #2
0
        public static Fund GetCurrentFundsInformation(Guid userId)
        {
            Fund f = new Fund();

            var dc = new ManagementContext();
            var funds = dc.Funds.Where(x => x.UserId == userId).FirstOrDefault();
            if (funds == null)
            {
                f.ActiveInUserAccount = 0.00;
                f.AmountToWithdraw = 0.00;
                f.TotalPaidToUser = 0.00;
            }
            else
            {
                f.AmountToWithdraw = funds.ActiveInUserAccount;
                f.ActiveInUserAccount = funds.ActiveInUserAccount;
                f.TotalPaidToUser = funds.TotalPaidToUser;
                f.BitCoinId = funds.BitCoinId;
                f.PaypalAddress = funds.PaypalAddress;
            }
            f.UserId = userId;

            return f;
        }