Exemplo n.º 1
0
        public async Task <IActionResult> AddOrder([FromBody] OrdersDTO orderDTO)
        {
            var order = _mapper.Map <Orders>(orderDTO);
            var res   = await _orderService.AddOrder(order);

            if (res == null)
            {
                return(BadRequest(res));
            }
            var resDto      = _mapper.Map <OrdersDTO>(res);
            var baseUrl     = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.ToUriComponent()}";
            var loactionUri = baseUrl + "/Ordering/" + res.Id.ToString();

            return(Created(loactionUri, resDto));
        }
Exemplo n.º 2
0
 public async Task Consume(ConsumeContext <CartCheckoutEvent> context)
 {
     await _orderService.AddOrder(context.Message);
 }