예제 #1
0
        public async Task <IList <Domain.Product> > Get(ProductSearchArgs args)
        {
            var products = await _fakeDB.ProductsAsync();

            if (args.Id.HasValue)
            {
                return(products.Where(c => c.Id == args.Id).ToList());
            }
            return(products.Where(c =>
                                  (c.Price < args.MaxPrice && c.Price >= args.MinPrice) ||
                                  c.CategoryId == args.CategoryId ||
                                  c.Stock > 0)
                   .Take(args.Quantity ?? 20).ToList());
        }
예제 #2
0
 public Task <IList <Product> > Get(ProductSearchArgs args)
 {
     return(_readonlyProductRepository.Get(args));
 }