public async Task <IActionResult> PutGateway(string id, Gateway gateway) { if (id != gateway.SerialNumber) { return(BadRequest()); } _context.Entry(gateway).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GatewayExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void Update(TEntity entity) { dbSet.Attach(entity); context.Entry(entity).State = EntityState.Modified; }