public async Task <IActionResult> Edit(int id, Exchange exchange) { if (id != exchange.ExchangeId) { return(NotFound()); } if (ModelState.IsValid) { try { bool result = await _repo.Update(exchange); if (result) { return(RedirectToAction("Index")); } return(View("Edit", new { id })); } catch { } } return(RedirectToAction("Error", "Home")); }