Exemplo n.º 1
0
 public DetailsModel(cryptoPortfolio.Models.PortfolioDbContext context, ILogger <DetailsModel> logger)
 {
     _context = context;
     _logger  = logger;
 }
Exemplo n.º 2
0
 public DetailsModel(cryptoPortfolio.Models.PortfolioDbContext context)
 {
     _context = context;
 }
Exemplo n.º 3
0
 public CreateModel(cryptoPortfolio.Models.PortfolioDbContext context)
 {
     _context = context;
 }
Exemplo n.º 4
0
 public EditModel(cryptoPortfolio.Models.PortfolioDbContext context)
 {
     _context = context;
 }
Exemplo n.º 5
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new PortfolioDbContext(serviceProvider.GetRequiredService <DbContextOptions <PortfolioDbContext> >()))
            {
                //look for any investors
                if (context.Investor.Any())
                {
                    return; //DB has been seeded
                }

                context.Investor.AddRange(
                    new Investor
                {
                    FirstName = "Aaron",
                    LastName  = "Phillips"
                },
                    new Investor
                {
                    FirstName = "Walter",
                    LastName  = "White"
                },
                    new Investor
                {
                    FirstName = "Mark",
                    LastName  = "Cuban"
                }
                    );

                context.SaveChanges();

                if (context.Crypto.Any())
                {
                    return;
                }

                context.Crypto.AddRange(
                    new Crypto
                {
                    Name       = "BitCoin",
                    Ticker     = "BTC",
                    Price      = 54792.00M,
                    Volatility = "Low"
                },
                    new Crypto
                {
                    Name       = "Ethereum",
                    Ticker     = "ETH",
                    Price      = 2009.00M,
                    Volatility = "Low"
                },
                    new Crypto
                {
                    Name       = "DogeCoin",
                    Ticker     = "Doge",
                    Price      = 0.37967M,
                    Volatility = "High"
                },
                    new Crypto
                {
                    Name       = "LiteCoin",
                    Ticker     = "LTC",
                    Price      = 250.50M,
                    Volatility = "Medium"
                },
                    new Crypto
                {
                    Name       = "BinanceCoin",
                    Ticker     = "BNB",
                    Price      = 488.38M,
                    Volatility = "Medium"
                },
                    new Crypto
                {
                    Name       = "Ripple",
                    Ticker     = "XRP",
                    Price      = 1.24M,
                    Volatility = "High"
                },
                    new Crypto
                {
                    Name       = "Tether",
                    Ticker     = "USDT",
                    Price      = 1.00M,
                    Volatility = "High"
                },
                    new Crypto
                {
                    Name       = "Cardano",
                    Ticker     = "ADA",
                    Price      = 1.15M,
                    Volatility = "Medium"
                },
                    new Crypto
                {
                    Name       = "Polkadot",
                    Ticker     = "DOT",
                    Price      = 34.05M,
                    Volatility = "Medium"
                },
                    new Crypto
                {
                    Name       = "Vechain",
                    Ticker     = "VET",
                    Price      = 0.2418M,
                    Volatility = "High"
                },
                    new Crypto
                {
                    Name       = "UniSwap",
                    Ticker     = "UNI",
                    Price      = 30.08M,
                    Volatility = "High"
                },
                    new Crypto
                {
                    Name       = "Chainlink",
                    Ticker     = "LINK",
                    Price      = 36.67M,
                    Volatility = "Medium"
                },
                    new Crypto
                {
                    Name       = "Stellar",
                    Ticker     = "XLM",
                    Price      = 0.4973M,
                    Volatility = "Medium"
                },
                    new Crypto
                {
                    Name       = "Theta Network",
                    Ticker     = "THETA",
                    Price      = 10.69M,
                    Volatility = "High"
                },
                    new Crypto
                {
                    Name       = "Solana",
                    Ticker     = "SOL",
                    Price      = 39.78M,
                    Volatility = "High"
                },
                    new Crypto
                {
                    Name       = "Filecoin",
                    Ticker     = "FIL",
                    Price      = 146.86M,
                    Volatility = "High"
                },
                    new Crypto
                {
                    Name       = "Tron",
                    Ticker     = "TRX",
                    Price      = 0.111M,
                    Volatility = "Medium"
                },
                    new Crypto
                {
                    Name       = "IOTA",
                    Ticker     = "MIOTA",
                    Price      = 1.84M,
                    Volatility = "High"
                },
                    new Crypto
                {
                    Name       = "Aave",
                    Ticker     = "AAVE",
                    Price      = 363.24M,
                    Volatility = "Low"
                },
                    new Crypto
                {
                    Name       = "Cosmos",
                    Ticker     = "ATOM",
                    Price      = 18.99M,
                    Volatility = "High"
                },
                    new Crypto
                {
                    Name       = "Ethereum Classic",
                    Ticker     = "ETC",
                    Price      = 34.46M,
                    Volatility = "Low"
                },
                    new Crypto
                {
                    Name       = "Tezos",
                    Ticker     = "XTZ",
                    Price      = 5.00M,
                    Volatility = "Medium"
                },
                    new Crypto
                {
                    Name       = "Siacoin",
                    Ticker     = "SC",
                    Price      = 0.036M,
                    Volatility = "Medium"
                },
                    new Crypto
                {
                    Name       = "Decentraland",
                    Ticker     = "MANA",
                    Price      = 1.23M,
                    Volatility = "High"
                },
                    new Crypto
                {
                    Name       = "Enjin Coin",
                    Ticker     = "ENJ",
                    Price      = 2.23M,
                    Volatility = "High"
                }
                    ); // 25 cryptos ready for a possible crytpo page to support paging.
                context.SaveChanges();
            }
        }