Beispiel #1
0
 public ActionResult CreateInvoice(InvoiceViewModel viewModel)
 => _invoiceOperation
 .Create(viewModel.ToDto())
 .Match <ActionResult>(Left: err => BadRequest(err.Message),
                       Right: i => Ok(InvoiceViewModel.FromDtoToView(FromEntity(i))));
Beispiel #2
0
 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))));
Beispiel #3
0
 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))));