public void Update(Item item) { using (var context = new ConcurrencyEntities()) { context.Items.Attach(item); context.Entry(item).State = EntityState.Modified; try { context.SaveChanges(); } catch (DbUpdateConcurrencyException updateConcurrencyException) { var ex = new ConcurrencyException("Update failed.", updateConcurrencyException); throw ex; } } }
public void Update(Item item) { using (var context = new ConcurrencyEntities()) { context.Items.Attach(item); context.Entry(item).State = EntityState.Modified; try { context.SaveChanges(); } catch (DbUpdateConcurrencyException updateConcurrencyException) { var ex = new ConcurrencyException("Update failed.", updateConcurrencyException); throw ex; } } }