public async Task <IEnumerable <Product> > Handle(GetProductsByIdsQuery request,
                                                          CancellationToken cancellationToken)
        {
            var response = await _repository.Products.GetProductsByMerchantNo(request.ProductIds);

            return(response);
        }
Esempio n. 2
0
        public async Task <IEnumerable <ProductQuery> > Handle(GetProductsByIdsQuery request, CancellationToken cancellationToken)
        {
            #region Persistence

            var productsDomain = await _ProductRepository.GetByIds(request.Ids);

            var response = productsDomain.Select(item => item.ToQueryModel <ProductQuery>(_Mapper));

            #endregion

            return(response);
        }
Esempio n. 3
0
        public async Task <IEnumerable <Infrastructure.Database.Query.Model.Product> > GetProductsOfProject(
            string ids,
            [Service] IServiceProvider serviceProvider,
            CancellationToken cancellationToken)
        {
            var guids = JsonConvert.DeserializeObject <List <Guid> >(ids);
            var getProductsByIdsQuery = new GetProductsByIdsQuery
            {
                Ids = guids
            };

            using (var scope = serviceProvider.CreateScope())
            {
                var mediator = scope.ServiceProvider.GetRequiredService <IMediator>();
                return(await mediator.Send(getProductsByIdsQuery, cancellationToken));
            }
        }
Esempio n. 4
0
        public async Task <IEnumerable <Product> > GetProducts(string[] productIds)
        {
            var query = new GetProductsByIdsQuery(productIds);

            return(await _mediator.Send(query));
        }