public bool Update( Fund funds) { var user = Membership.GetUser(Security.CurrentUser.Identity.Name); Guid id = (Guid)user.ProviderUserKey; funds.UserName = Security.CurrentUser.Identity.Name; funds.UserId = id; return Fund.SaveCurrentPaypalBitcoinInformation(funds); }
public static bool SaveCurrentPaypalBitcoinInformation(Fund fund) { var dc = new RNManagementContext(); 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; }
public static Fund GetCurrentFundsInformation(Guid userId) { Fund f = new Fund(); var dc = new RNManagementContext(); 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.ActiveInUserAccount = funds.ActiveInUserAccount; f.TotalPaidToUser = funds.TotalPaidToUser; f.BitCoinId = funds.BitCoinId; f.PaypalAddress = funds.PaypalAddress; } f.UserId = userId; return f; }