コード例 #1
0
 public void Update(MoneyAccount t)
 {
     var existing = _currentMoneyAccountState.SingleOrDefault(a => a.Id == t.Id);
     if (existing != null)
     {
         existing.UserId = t.UserId;
         existing.Balance = t.Balance;
     }
 }
コード例 #2
0
ファイル: Market.cs プロジェクト: neolee11/RecipeTraderDotNet
        public string CreateUserMoneyAccount(string userId, decimal initBalance = 100)
        {
            if (_moneyAccountRepo.GetUserMoneyAccount(userId) != null)
            {
                return $"User ID {userId} already exists. Choose another User ID";
            }

            initBalance = initBalance < 0 ? 100 : initBalance;
            var moneyAccount = new MoneyAccount
            {
                UserId = userId,
                Balance = initBalance
            };

            _moneyAccountRepo.Insert(moneyAccount);

            return string.Empty;
        }
コード例 #3
0
 public void Update(MoneyAccount t)
 {
     throw new NotImplementedException();
 }
コード例 #4
0
 public void Insert(MoneyAccount t)
 {
     var random = new Random();
     t.Id = random.Next(1, Int32.MaxValue);
     _currentMoneyAccountState.Add(t);
 }
コード例 #5
0
 public void Insert(MoneyAccount t)
 {
     throw new NotImplementedException();
 }