Exemple #1
0
        public IEnumerable <ProductViewModel> Get(long consumption)
        {
            if (consumption < 0)
            {
                throw new BadRequestException("Consumption have to be positive number");
            }

            _productBuilder.SetConsumption(consumption);
            var products = _productBuilder.Build();

            Array.Sort(products, _productComparer);

            return(_mapper.Map <IEnumerable <ProductViewModel> >(products));
        }