コード例 #1
0
        public async Task <List <BonusDto> > FindBonusesAsync(BonusFilter bonusFilter, CancellationToken cancellationToken)
        {
            var sortBy = bonusFilter?.SortBy ?? "Title";

            if (sortBy != null & typeof(Bonus).GetProperty(sortBy) == null)
            {
                throw new ArgumentException(Resources.PropertyDoesNotExist);
            }

            var result = await _bonusRepository.GetBonusesAsync(bonusFilter, cancellationToken);

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