public async Task <IActionResult> Edit([FromForm] InventoryEditViewModel inputModel) { if (ModelState.IsValid) { return(await resiliencyHelper.ExecuteResilient(async() => { try { var command = new UpdateInventory(Guid.NewGuid(), Guid.NewGuid(), inputModel.Inventory.ProductCode, inputModel.Inventory.Description, inputModel.Inventory.Quantity, inputModel.Inventory.UnitPrice); await inventoryManagementAPI.UpdateInventory(command); } catch (ApiException ex) { if (ex.StatusCode == HttpStatusCode.Conflict) { var content = await ex.GetContentAsAsync <InventoryRuleViolation>(); inputModel.Error = content.ErrorMessage; return View("Edit", inputModel); } } return RedirectToAction("Index"); }, View("Offline", new InventoryOfflineViewModel()))); } else { return(View("Edit", inputModel)); } }
public async Task UpdateInventory(UpdateInventory command) { await restClient.UpdateInventory(command); }