public virtual void Update(TEntity entity)
        {
            var local = _db.Set <TEntity>().Local.FirstOrDefault(f => f.CustomerID == customer.CustomerID);

            if (local != null)
            {
                db.Entry(local).State = EntityState.Detached;
            }
            _dbset.Attach(entity);
            _db.Entry(entity).State = EntityState.Modified;
        }
Ejemplo n.º 2
0
 public bool DeleteCustomer(Customers customer)
 {
     try
     {
         db.Entry(customer).State = EntityState.Deleted;
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
 public bool UpdateCustomer(Customers customer)
 {
     try
     {
         db.Entry(customer).State = EntityState.Modified;
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
 public bool UpdateCustomer(Customers customer)
 {
     try
     {
         context.Customers.Attach(customer);
         context.Entry(customer).State = EntityState.Modified;
         return(true);
     }
     catch
     {
         return(false);
     }
 }
        public bool UpdateCustomer(Customers customer)
        {
            var local = db.Set <Customers>()
                        .Local
                        .FirstOrDefault(f => f.CustomerID == customer.CustomerID);

            if (local != null)
            {
                db.Entry(local).State = EntityState.Detached;
            }
            db.Entry(customer).State = EntityState.Modified;
            return(true);
        }
 public virtual void Update(TEntity entity)
 {
     _dbSet.Attach(entity);
     _db.Entry(entity).State = EntityState.Modified;
 }
 public void Update(Customers customer)
 {
     db.Entry(customer).State = EntityState.Modified;
 }
Ejemplo n.º 8
0
 public virtual void Update(EntityType entity)
 {
     _db.Entry(entity).State = EntityState.Modified;
 }