Beispiel #1
0
        private static void AddTestData(CardCostContext context)
        {
            var cardCost1 = new CardCostEntity
            {
                Country = "GR",
                Cost    = 10
            };

            context.CardCosts.Add(cardCost1);

            var cardCost2 = new CardCostEntity
            {
                Country = "US",
                Cost    = 15
            };

            context.CardCosts.Add(cardCost2);

            context.SaveChanges();
        }
        protected void ResetDb(CardCostContext context)
        {
            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            var cardCost1 = new CardCostEntity
            {
                Country = "GR",
                Cost    = 10
            };

            context.CardCosts.Add(cardCost1);

            var cardCost2 = new CardCostEntity
            {
                Country = "US",
                Cost    = 15
            };

            context.CardCosts.Add(cardCost2);

            context.SaveChanges();
        }
 public async Task DeleteAsync(CardCostEntity entity)
 {
     _dbContext.Entry(entity).State = EntityState.Deleted;
     await _dbContext.SaveChangesAsync();
 }