public ActionResult CreateInvoice(InvoiceViewModel viewModel) => _invoiceOperation .Create(viewModel.ToDto()) .Match <ActionResult>(Left: err => BadRequest(err.Message), Right: i => Ok(InvoiceViewModel.FromDtoToView(FromEntity(i))));
public ActionResult UpdateInvoice(int id, InvoiceViewModel viewModel) => _invoiceOperation .Update(id, viewModel.ToDto()) .Match <ActionResult>(Left: err => BadRequest(err.Message), Right: c => Ok(InvoiceViewModel.FromDtoToView(FromEntity(c))));
public async Task <IActionResult> GetInvoice(int id) => (await _invoiceOperation.FindAsync(id)) .Match <ActionResult>(Left: err => NotFound(err.Message), Right: c => Ok(InvoiceViewModel.FromDtoToView(FromEntity(c))));