Esempio n. 1
0
            public async Task CleanUp()
            {
                var lineItems = await _db.LineItems.ToListAsync();

                foreach (LineItem item in lineItems)
                {
                    _db.Remove(item);
                    _db.Entry(item).State = EntityState.Deleted;
                }
                _db.Remove(vendor);
                _db.Entry(vendor).State = EntityState.Deleted;
                _db.Remove(powderInfo);
                _db.Entry(powderInfo).State = EntityState.Deleted;
                // tell the db all the pilots were removed
                await _db.SaveChangesAsync();
            }
Esempio n. 2
0
        public async Task CleanUpAdd()
        {
            // get all pilots in the db
            var users = await _db.Users.ToListAsync();

            // walk through and remove them
            foreach (User user in users)
            {
                _db.Remove(user);
                _db.Entry(user).State = EntityState.Deleted;
            }
            // tell the db all the pilots were removed
            await _db.SaveChangesAsync();
        }