Exemplo n.º 1
0
        public ActionResult GenerateNewOrder([FromBody] invoiceModel invoice)
        {
            _logger.LogInformation("generating invoice");
            var order = OrderMapper.SerializeInvoiceToOrder(invoice);

            order.Customer = _customerService.GetByIdCustomer(invoice.CustomerId);
            _orderService.GenerateInvoiceForOrder(order);
            return(Ok());
        }
Exemplo n.º 2
0
        public IActionResult GenerateNewOrder([FromBody] InvoiceModel invoice)
        {
            logger.LogInformation("Generating invoice");
            var order    = OrderMapper.SerializeInvoiceToOrder(invoice);
            var response = customerService.GetById(invoice.CustomerId);

            order.Customer = response.Item1;
            orderService.GenerateOpenOrder(order);
            return(Ok());
        }
Exemplo n.º 3
0
        public ActionResult GenerateNewOrder([FromBody] InvoiceModel invoice)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            _logger.LogInformation("Generating invoice");
            var order = OrderMapper.SerializeInvoiceToOrder(invoice);

            order.Customer = _customerService.GetById(invoice.CustomerId);
            return(Ok());
        }
Exemplo n.º 4
0
 public ActionResult GenerateNewOrder([FromBody] InvoiceModel invoice) // body structure must match InvoiceModel class
 {
     if (!ModelState.IsValid)
     {
         return BadRequest(ModelState);
     }
     _logger.LogInformation("Generating invoice");
     var order = OrderMapper.SerializeInvoiceToOrder(invoice);
     order.Customer = _customerService.GetById(invoice.CustomerId);
     _orderService.GenerateOpenOrder(order);
     return Ok();
 }
Exemplo n.º 5
0
        public ActionResult GenerateNewOrder([FromBody] InvoiceModel invoice)
        {
            // check if .NET binded successfully client request fields to our OrderModel
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _logger.LogInformation("Generating invoice");
            var order = OrderMapper.SerializeInvoiceToOrder(invoice);

            order.Customer = _customerService.GetById(invoice.CustomerId);
            _orderService.GenerateOpenOrder(order);
            return(Ok());
        }