예제 #1
0
        public void BuyReward(int rewardID)
        {
            using (var trs = transactionScopeProvider.CreateTransactionScope())
            {
                var user   = GetCurrentUser();
                var reward = rewardRepository.GetById(rewardID);

                var result = rewardService.CanBuyReward(reward, user);
                if (result.IsError)
                {
                    result.ThrowHttpException(System.Net.HttpStatusCode.Conflict);
                }

                rewardService.BuyReward(reward, user);
                trs.Complete();
            }
        }