Ejemplo n.º 1
0
        public async Task AddForTest(User user)
        {
            await _db.Users.AddAsync(user);

            _db.Entry(user).State = EntityState.Added;
            await _db.SaveChangesAsync();
        }
Ejemplo n.º 2
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();
            }