/// <summary>
        ///  Adding new products into the OrderFlow database, and for updating existing products
        /// </summary>
        /// <param name="request">product data to be created or updated</param>
        /// <param name="organization">Organization Name</param>
        /// <returns></returns>
        public virtual CreateOrUpdateEntityRootResponse CreateOrUpdateProduct(ImportProductRequest request, string organization)
        {
            var response          = new CreateOrUpdateEntityRootResponse();
            var product           = request.Import;
            var validatorResponse = GetValidatorResponse(product);

            if (validatorResponse.IsValidRequest)
            {
                var result = ExecutePostRequest <CreateOrUpdateEntityResponse>(new ProfulfilmentRequestContent
                {
                    RequestUri = PrepareRequestUrl("remotewarehouse/imports/importitems.xml"),
                    PostData   = ProfulfilmentEntityRequestBody.Product(product),
                    HttpMethod = HttpMethod.Post,
                    Headers    = new Dictionary <string, string> {
                        { "organisation", organization }
                    }
                });
                response.CreateOrUpdateEntityResponse = result;
                return(response);
            }
            response.ValidationError = validatorResponse.ValidationErrors;
            return(response);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Import(ImportProductRequest request, CancellationToken cancellationToken = default)
        {
            await _mediator.Send(request, cancellationToken);

            return(Ok());
        }