Esempio n. 1
0
        private void ImportCurrencies(ImsContext context)
        {
            var currencies = GetJson <Dictionary <string, string> >(Path.Combine(_contentRootPath, "Infrastructure", "Data", "Import",
                                                                                 "currencies.json"));

            foreach (var currency in currencies)
            {
                context.Set <InvestmentTool>().Add(new InvestmentTool(currency.Key, currency.Value, string.Empty,
                                                                      InvestmentToolType.Currency.EnumId));
            }
            context.SaveChanges();
        }
Esempio n. 2
0
        private void ImportEmtias(ImsContext context)
        {
            var emtias = GetJson <List <GoldSeed> >(Path.Combine(_contentRootPath, "Infrastructure", "Data", "Import",
                                                                 "emtias.json"));

            foreach (var emtia in emtias)
            {
                var country        = context.Set <Country>().FirstOrDefault(c => c.Code == "TR");
                var investmentTool = new InvestmentTool(emtia.Name, emtia.Title, "", InvestmentToolType.Emtia.EnumId);
                context.Set <InvestmentTool>().Add(investmentTool);
            }
            context.SaveChanges();
        }
Esempio n. 3
0
        private void ImportStocks(ImsContext context)
        {
            var stocks = GetJson <List <StockSeed> >(Path.Combine(_contentRootPath, "Infrastructure", "Data", "Import",
                                                                  "stocks.json"));

            foreach (var stock in stocks)
            {
                var country        = context.Set <Country>().FirstOrDefault(c => c.Code == "TR");
                var investmentTool = new InvestmentTool(stock.Code, stock.Name, "", InvestmentToolType.Stock.EnumId);
                context.Set <InvestmentTool>().Add(investmentTool);
            }
            context.SaveChanges();
        }
Esempio n. 4
0
        private void ImportCountries(ImsContext context)
        {
            var countries = GetJson <List <CountrySeed> >(Path.Combine(_contentRootPath, "Infrastructure", "Data", "Import",
                                                                       "countries.json"));

            foreach (var country in countries)
            {
                var currency = context.Set <InvestmentTool>().FirstOrDefault(i =>
                                                                             i.InvestmentToolTypeId == InvestmentToolType.Currency.EnumId && i.Code == country.CurrencyCode);

                context.Set <Country>().Add(new Country(country.CountryCode, country.CountryName, currency?.Id));
            }
            context.SaveChanges();
        }