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