Example #1
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();
        }
Example #2
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();
        }
Example #3
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();
        }
Example #4
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();
        }
Example #5
0
 public BaseService(ImsContext context, IHttpContextAccessor httpContextAccessor)
 {
     _context             = context;
     _httpContextAccessor = httpContextAccessor;
     _entity = _context.Set <T>();
 }