Exemplo n.º 1
0
        public void DeleteCustomersByAddress(string address)
        {
            using (RetailEntities context = new RetailEntities())
            {
                List <Customer> entities = context.Customers.AsQueryable().Where(c => c.Address == address).ToList();

                foreach (var entity in entities)
                {
                    context.Set <Customer>().Remove(entity);
                }

                context.SaveChanges();
            }
        }
        public void DeleteCustomersByAddress(string address)
        {
            using (RetailEntities context = new RetailEntities())
              {
            List<Customer> entities = context.Customers.AsQueryable().Where(c => c.Address == address).ToList();

            foreach (var entity in entities)
            {
              context.Set<Customer>().Remove(entity);
            }

            context.SaveChanges();
              }
        }
Exemplo n.º 3
0
        public void DeleteAllCustomers()
        {
            using (RetailEntities context = new RetailEntities())
            {
                List <Customer> entities = context.Customers.AsQueryable().ToList();

                foreach (var entity in entities)
                {
                    context.Set <Customer>().Remove(entity);
                }

                context.SaveChanges();

                //context.ExecuteStoreCommand("TRUNCATE TABLE [RETAIL].[STORE].[Customer]");
            }
        }
        public void DeleteAllCustomers()
        {
            using (RetailEntities context = new RetailEntities())
              {
            List<Customer> entities = context.Customers.AsQueryable().ToList();

            foreach (var entity in entities)
            {
              context.Set<Customer>().Remove(entity);
            }

            context.SaveChanges();

            //context.ExecuteStoreCommand("TRUNCATE TABLE [RETAIL].[STORE].[Customer]");
              }
        }