public async Task <IActionResult> PutLink(int id, Link link) { if (id != link.Id) { return(BadRequest()); } _context.Entry(link).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LinkExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void Update(T entity) { dbSet.Attach(entity); _context.Entry(entity).State = EntityState.Modified; }