コード例 #1
0
        protected override async Task HandleCore(AddProductCommand command)
        {
            var products = await _productSearcher.SearchAsync(new ProductSearchCriteria
            {
                Sort     = "product_id",
                PageSize = Int32.MaxValue
            });

            var last = products.Items.LastOrDefault();

            if (last != null)
            {
                command.Product.product_id = last.product_id + 1;
            }
            else
            {
                command.Product.product_id = 1;
            }

            await _productRepository.AddAsync(command.Product);
        }
コード例 #2
0
 public async Task <ProductSearchResult> SearchAsync(ProductSearchCriteria criteria)
 {
     return(await _productSearcher.SearchAsync(criteria));
 }