public async Task <OperationResult <InvoiceDetailsVM> > UpdateInvoice(InvoiceUpdateVM invoice, CancellationToken cancellationToken) { var requestUrl = $"{_url}{invoice.InvoiceId}"; var result = await _apiClient.PutAsync <InvoiceUpdateVM, OperationResult <InvoiceDetailsVM> >(requestUrl, invoice); return(result); }
public async Task <IActionResult> Edit(Guid id, [Bind("InvoiceId,Supplier,DateIssued,Currency,Amount,Description")] InvoiceUpdateVM invoiceUpdateVM) { if (id != invoiceUpdateVM.InvoiceId) { return(NotFound()); } if (!ModelState.IsValid) { return(View(invoiceUpdateVM)); } var result = await _invoiceManagerApi.UpdateInvoice(invoiceUpdateVM, new CancellationToken()); if (result.NotFound) { return(NotFound()); } if (!result.Success) { return(View("InvoiceError")); } return(RedirectToAction(nameof(Index))); }