コード例 #1
0
        public async Task <BonusDto> DeleteBonusAsync(Guid id, CancellationToken cancellationToken)
        {
            if (id == Guid.Empty)
            {
                throw new ArgumentNullException("", Resources.IdentifierIsNull);
            }

            var result = await _bonusRepository.RemoveAsync(id, cancellationToken);

            return(_mapper.Map <BonusDto>(result));
        }
コード例 #2
0
ファイル: BonusService.cs プロジェクト: EXAN7742/BonusPlus
        public async Task <BonusDto> DeleteBonusAsync(Guid id, CancellationToken cancellationToken)
        {
            if (id == Guid.Empty)
            {
                throw new ArgumentNullException("", Resources.IdentifierIsNull);
            }


            var histories = await _historyRepository.GetBonusHistoryByUsageDate(id, DateTime.MinValue, DateTime.MaxValue,
                                                                                cancellationToken);

            if (histories.Any())
            {
                throw new ArgumentException(Resources.UnableToRemoveBonus);
            }

            var result = await _bonusRepository.RemoveAsync(id, cancellationToken);

            return(_mapper.Map <BonusDto>(result));
        }