public void Update(int id, Artwork obj) { try { _context.Update(obj); _context.SaveChanges(); } catch (DbUpdateConcurrencyException e) { throw new DbConcurrencyException(e.Message); } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Team team) { if (id != team.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(team); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeamExists(team.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(team)); }