コード例 #1
0
        public virtual void Delete(TEntity entity)
        {
            if (_db.Entry(entity).State == EntityState.Detached)
            {
                _dbset.Attach(entity);
            }

            _dbset.Remove(entity);
        }
コード例 #2
0
 public bool DeleteCustomer(CustomerTB customer)
 {
     try
     {
         _db.Entry(customer).State = EntityState.Deleted;
         return(true);
     }
     catch
     {
         return(false);
     }
 }