public async Task <IActionResult> Get(Guid customerId)
 {
     return(await HandleAsync(async() =>
     {
         var client = clientFactory.Create <GetShoppingCartByCustomerRequest, GetShoppingCartResponse>();
         return await client.Request(new GetShoppingCartByCustomerRequest(customerId));
     }));
 }
        public async Task <IActionResult> Create([FromBody] CreateOrderRequest request)
        {
            return(await HandleAsync(async() =>
            {
                var client = getClientFactory.Create <CreateOrderRequest, CreateOrderResponse>();

                var response = await client.Request(request);
                response.RequestUri = Url.Link(Routing.GetOrder, new { id = response.Order.Id });
                return response;
            }));
        }
Esempio n. 3
0
        public async Task <IActionResult> Get(Guid id)
        {
            var client = getClientFactory.Create <IGetCustomerRequest, GetCustomerResponse>();

            return(await HandleAsync(async() => await client.Request(new { Id = id }, CancellationToken.None)));
        }
 public ProductsController(IRequestClientFactory clientFactory, ILoggerFactory loggerFactory)
     : base(loggerFactory)
 {
     this.client = clientFactory.Create <GetAllProductsRequest, GetAllProductsResponse>();
 }