public static async Task SeedAsync(RetailDbContext dbContext)
        {
            dbContext.Database.EnsureCreated();

            if (!dbContext.Currencies.Any())
            {
                dbContext.Currencies.AddRange(GerPreconfiguredCurrency());

                await dbContext.SaveChangesAsync();
            }
        }
Exemple #2
0
        private async void UpdateDB()
        {
            try
            {
                await db.SaveChangesAsync();

                ShowUserMessage("Database Updated");
            }
            catch (Exception e)
            {
                if (System.Diagnostics.Debugger.IsAttached)
                {
                    ErrorMessage = e.InnerException.GetBaseException().ToString();
                }
                ShowUserMessage("There was a problem updating the database");
            }
            ReFocusRow();
        }
Exemple #3
0
 public async Task SaveChangesAsync()
 {
     await _dbContext.SaveChangesAsync();
 }
        public async Task Create(T entity)
        {
            await _dbContext.Set <T>().AddAsync(entity);

            await _dbContext.SaveChangesAsync();
        }