コード例 #1
0
        public async Task <IEnumerable <Promotion> > GetPromotionsAsync(bool showComments, string orderBy)
        {
            var orderByLower = orderBy.ToLower();

            if (!allowedOrderByValues.Contains(orderByLower))
            {
                throw new BadRequestOperationException($"invalid Order By value : {orderBy} the only allowed values are {string.Join(", ", allowedOrderByValues)}");
            }
            var promotionsEntities = await premierLeagueRepository.GetPromotionsAsync(showComments, orderByLower);

            return(mapper.Map <IEnumerable <Promotion> >(promotionsEntities));
        }