Exemplo n.º 1
0
        public static void SeedCurrencies(WebAppDbContext dbContext)
        {
            if (!dbContext.Currencies.Any())
            {
                dbContext.AddRange(new List <Currency>
                {
                    new Currency
                    {
                        Name        = "USD",
                        Value       = 1,
                        ChangeStamp = DateTime.Now
                    },
                    new Currency
                    {
                        Name        = "ARS",
                        Value       = 0,
                        ChangeStamp = DateTime.Now
                    },
                    new Currency
                    {
                        Name        = "EUR",
                        Value       = 0,
                        ChangeStamp = DateTime.Now
                    }
                });

                dbContext.SaveChanges();
            }
        }
Exemplo n.º 2
0
        public static void SeedCategories(this WebAppDbContext context)
        {
            if (context.Categories.Count() > 0)
            {
                return;
            }

            context.Categories.AddRange(GetDefaultCategories());

            context.SaveChanges();
        }
Exemplo n.º 3
0
        public static void SeedSettings(this WebAppDbContext context)
        {
            if (context.ConfigurationSettings.Count() > 0)
            {
                return;
            }

            context.ConfigurationSettings.Add(new Domain.ConfigurationSetting
            {
                Name  = "CurrencyService_API",
                Value = string.Empty
            });

            context.ConfigurationSettings.Add(new Domain.ConfigurationSetting
            {
                Name  = "CurrencyService_AppId",
                Value = string.Empty
            });

            context.ConfigurationSettings.Add(new Domain.ConfigurationSetting
            {
                Name  = "Dropbox_AppId",
                Value = string.Empty
            });

            context.ConfigurationSettings.Add(new Domain.ConfigurationSetting
            {
                Name  = "Dropbox_AppSecret",
                Value = string.Empty
            });

            context.ConfigurationSettings.Add(new Domain.ConfigurationSetting
            {
                Name  = "VisionApiKey",
                Value = string.Empty
            });

            context.ConfigurationSettings.Add(new Domain.ConfigurationSetting
            {
                Name  = "VisionApiEndpoint",
                Value = string.Empty
            });

            context.SaveChanges();
        }