public async Task <IActionResult> Edit(int id, [Bind("Id,Number,Pin,Balance,IsValid")] CreditCard creditCard) { if (id != creditCard.Id) { return(NotFound()); } if (ModelState.IsValid) { try { await _creditCardService.EditCreditCard(creditCard); } catch (InvalidOperationException) { if (!CreditCardExists(creditCard.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(creditCard)); }