示例#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());
        }
        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());
        }
示例#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());
        }
示例#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();
 }
示例#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());
        }