コード例 #1
0
        /// <summary>
        /// Creates a fund reservation and returns the id
        /// </summary>
        /// <param name="accountId"></param>
        /// <param name="reservationKey"></param>
        /// <param name="amount"></param>
        /// <param name="expiresIn"></param>
        /// <returns></returns>
        public void CreateFundReservation(int accountId, Guid reservationKey, decimal amount, TimeSpan? expiresIn = null)
        {
            // create fund reservation
            var fundReservation = new CashAccountFundReservation
                {
                    AccountId = accountId,
                    ReservationKey = reservationKey.ToString(),
                    Amount = amount,
                    Expiration = expiresIn.HasValue ? (DateTime?)(DateTime.Now + expiresIn.Value) : null,
                    Created = DateTime.Now,
                    Modified = DateTime.Now
                };

            // add to db set
            CashAccountFundReservations.Add(fundReservation);

            // save changes in repository
            SaveChanges();
        }
コード例 #2
0
        /// <summary>
        /// Creates a fund reservation and returns the id
        /// </summary>
        /// <param name="accountId"></param>
        /// <param name="reservationKey"></param>
        /// <param name="amount"></param>
        /// <param name="expiresIn"></param>
        /// <returns></returns>
        public void CreateFundReservation(int accountId, Guid reservationKey, decimal amount, TimeSpan?expiresIn = null)
        {
            // create fund reservation
            var fundReservation = new CashAccountFundReservation
            {
                AccountId      = accountId,
                ReservationKey = reservationKey.ToString(),
                Amount         = amount,
                Expiration     = expiresIn.HasValue ? (DateTime?)(DateTime.Now + expiresIn.Value) : null,
                Created        = DateTime.Now,
                Modified       = DateTime.Now
            };

            // add to db set
            CashAccountFundReservations.Add(fundReservation);

            // save changes in repository
            SaveChanges();
        }