Ejemplo n.º 1
0
        public async Task <IEnumerable <Commentary> > GetComments(int promotionId)
        {
            string orderBy      = "id";
            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 commentsEntities = await premierLeagueRepository.GetCommentsAsync(promotionId, orderByLower);

            return(mapper.Map <IEnumerable <Commentary> >(commentsEntities));
        }