public async Task <IActionResult> CreateConstructorInvoices([FromBody] InvoiceConstructorViewModel model) { try { if (!ModelState.IsValid) { throw new Exception("Form is not valid!"); } var result = await _businessManager.CreateInvoiceDraft(_mapper.Map <InvoiceConstructorDto>(model)); if (result == null) { return(NotFound()); } return(Ok(_mapper.Map <InvoiceConstructorViewModel>(result))); } catch (Exception er) { return(BadRequest(er.Message ?? er.StackTrace)); } }