Пример #1
0
        public async Task <IEnumerable <Product> > Handle(GetTopProducts getTopProducts)
        {
            var db       = _container.Resolve <SampleContext>();
            var products = await _repository.FindAll <Product>()
                           .OrderByDescending(p => p.CreateTime)
                           .Take(getTopProducts.Count)
                           .ToListAsync()
                           .ConfigureAwait(false);

            return(products);
        }
Пример #2
0
 public async Task <ApiResult <IEnumerable <Product> > > GetTopProducts([FromUri] GetTopProducts getTopProducts)
 {
     return(await ProcessAsync(() => _productService.Handle(getTopProducts)));
 }