/// <summary>
 /// Deprecated Method for adding a new object to the RechargeRecords EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToRechargeRecords(RechargeRecord rechargeRecord)
 {
     base.AddObject("RechargeRecords", rechargeRecord);
 }
        public void Recharge(string userName, int coins)
        {
            using (UserRepository userRepository = new UserRepository())
            {
                var user = userRepository.Get(userName);
                if (user != null)
                {
                    // TODO: call 3rd party recharge request

                    userRepository.TrackEntity(user);
                    user.Recharge(coins);
                    var rechargeRecord = new RechargeRecord { Coins = coins, RechargeTime = DateTime.Now, UserId = user.Id };
                    user.RechargeRecords.Add(rechargeRecord);
                    userRepository.Commit();
                    // send recharege email
                    SendMail(user, HostSendMail.EmailCategory.Recharge);
                }
            }
        }
 /// <summary>
 /// Create a new RechargeRecord object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="userId">Initial value of the UserId property.</param>
 /// <param name="coins">Initial value of the Coins property.</param>
 /// <param name="rechargeTime">Initial value of the RechargeTime property.</param>
 public static RechargeRecord CreateRechargeRecord(global::System.Int32 id, global::System.Guid userId, global::System.Int32 coins, global::System.DateTime rechargeTime)
 {
     RechargeRecord rechargeRecord = new RechargeRecord();
     rechargeRecord.Id = id;
     rechargeRecord.UserId = userId;
     rechargeRecord.Coins = coins;
     rechargeRecord.RechargeTime = rechargeTime;
     return rechargeRecord;
 }