Exemplo n.º 1
0
        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;
                }
            }
        }
Exemplo n.º 2
0
        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;
                }
            }
        }