public IActionResult CreateInvoice([FromBody] InvoiceForm form) { Error error = new Error(); var invoiceId = _invoiceManager.CreateInvoice(form.MapToCore(), ref error); if (error.ErrorCode != ErrorCode.OKAY) { return(BadRequest(error.Message)); } return(Ok(new { InvoiceId = invoiceId })); }
public IActionResult EditInvoice([FromBody] InvoiceForm form) { Error error = new Error(); _invoiceManager.RemoveCityExpensesFromInvoice(form.CityExpensesToRemove); _invoiceManager.RemoveInvoiceAccounts(form.InvoiceAccountsToRemove); var invoice = _invoiceManager.EditInvoice(form.MapToCore(), ref error); if (error.ErrorCode != ErrorCode.OKAY) { return(BadRequest(error.Message)); } var response = InvoiceDetails.MapFromObject(invoice); return(Ok(response)); }