public IHttpActionResult CreateBasedOnOrder(int orderId, [FromBody] InvoiceModel invoice) { if (invoice == null) { return(BadRequest()); } try { _invoices.CreateBasedOnOrder(orderId, invoice); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }