public InvestimentList <StockExchangeShares> Get()
        {
            //Nova intancia de lista de ações
            var stockExchangeSharesList = new InvestimentList <StockExchangeShares>();

            //intancia de classe random para valores aleatorios
            Random random = new Random();

            // For para gerar novas ações
            for (int i = 0; i < 6; i++)
            {
                var initialsStockEx = Enum.GetNames(typeof(InitialsStockExchangeShare));

                //Nova instancia de ação atribuindo dados a ela
                var stockExchangeShares = new StockExchangeShares();
                stockExchangeShares.Name                    = $"Teste{i}";
                stockExchangeShares.Pl                      = random.NextDouble() * 10;
                stockExchangeShares.Roe                     = random.NextDouble() * 10;
                stockExchangeShares.SharePrice              = random.NextDouble() * 100;
                stockExchangeShares.MonthlyProfitability    = random.Next(10, 50);
                stockExchangeShares.Initials                = initialsStockEx[random.Next(initialsStockEx.Length)];
                stockExchangeShares.Description             = "Ação teste";
                stockExchangeShares.TypeStockExchangeShares = "on";
                stockExchangeSharesList.SetInvestment(stockExchangeShares);
            }
            return(stockExchangeSharesList);
        }
Beispiel #2
0
        public InvestimentList <Investments> Get()
        {
            // Intancia de uma nova lista de investimentos (InvestimentList)
            var investimentList = new InvestimentList <Investments>();

            // Intanciando a classe Random para gerar valores de rentabilidade aleatorios e siglas aleatorias;
            Random random = new Random();

            //Gerando nova lista de investimentos com 6
            for (int i = 0; i < 6; i++)
            {
                //Intanciando classes de investimentos
                var directTreasure      = new DirectTreasure();
                var investmentFunds     = new InvestmentFunds();
                var stockExchangeShares = new StockExchangeShares();


                //Adicionando suas caracteristicas

                var initialsStockEx = Enum.GetNames(typeof(InitialsStockExchangeShare));
                stockExchangeShares.Name = $"Ação{i}";
                stockExchangeShares.MonthlyProfitability = random.Next(10, 50);
                stockExchangeShares.Initials             = initialsStockEx[random.Next(initialsStockEx.Length)];
                stockExchangeShares.Description          = "Ação teste";


                investmentFunds.Name = $"Fundo de Investimento{i + 1}";
                investmentFunds.MonthlyProfitability = 21;
                investmentFunds.Description          = "Teste Descrição";
                investmentFunds.Initials             = "SLA";


                var valuesinitials = Enum.GetNames(typeof(InitialsTypeDirectTreasure));
                directTreasure.Name                 = $"Tesouro direto{i + 1}";
                directTreasure.Description          = $"Descrição teste{i + 1}";
                directTreasure.MonthlyProfitability = random.Next(1, 45);
                directTreasure.Initials             = valuesinitials[random.Next(valuesinitials.Length)];

                investimentList.SetInvestment(stockExchangeShares);
                investimentList.SetInvestment(directTreasure);
                investimentList.SetInvestment(investmentFunds);
            }

            return(investimentList);
        }