public async Task <IActionResult> UpdateExchange(int id, [Bind("ID,Title")] Exchange exchange) { if (id != exchange.ID) { return(NotFound()); } if (ModelState.IsValid) { try { ExchangeUpdater.Update(_context); } catch (DbUpdateConcurrencyException) { if (!ExchangeExists(exchange.ID)) { return(NotFound()); } else { throw; } } } return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> UpdateExchange(int?id) { if (id == null) { return(NotFound()); } var exchange = await _context.Exchange .FirstOrDefaultAsync(m => m.ID == id); if (exchange == null) { return(NotFound()); } try { ExchangeUpdater.RemoveAllWatchedTokens(_context, (int)id); ExchangeUpdater.Update(_context); } catch (DbUpdateConcurrencyException) { if (!ExchangeExists(exchange.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Details), new { id = exchange.ID })); }