예제 #1
0
파일: Program.cs 프로젝트: ozcarzarate/Asx
 static void Main(string[] args)
 {
     using (var context = new InvestmentContext())
     {
         var investment = context.Shares.ToList();
     }
 }
예제 #2
0
 public void Configure(
     IApplicationBuilder app,
     IHostingEnvironment env,
     InvestmentContext context)
 {
     if (env.IsDevelopment())
     {
         app.UseDeveloperExceptionPage();
     }
     new InvestmentDatabase().Initialize(context);
     app.UseMvc();
 }
예제 #3
0
 public SecurityPriceRepository(InvestmentContext context)
 {
     this.dataContext = context;
 }
 public AccountPositionsRepository(InvestmentContext context)
 {
     this.dbContext = context;
 }
 public AccountCashFlowsRepository(InvestmentContext context)
 {
     this.dbContext = context;
 }
예제 #6
0
 public InvestmentRepository(InvestmentContext investmentContext)
 {
     _investmentContext = investmentContext;
 }
예제 #7
0
 public TradeDateRepository(InvestmentContext context)
 {
     this.dbContext = context;
 }
예제 #8
0
 public AccountMarketValueRepository(InvestmentContext context)
 {
     this.dbContext = context;
 }
예제 #9
0
        public static void Initialize(IServiceProvider service)
        {
            using (var context = new InvestmentContext(
                       service.GetRequiredService <DbContextOptions <InvestmentContext> >()))
            {
                Random rand = new Random();

                var inv1 = new Investment()
                {
                    Id             = 1,
                    UserId         = 100,
                    Name           = "APPL",
                    TimeOfPurchase = DateTime.Now
                };

                var inv2 = new Investment()
                {
                    Id             = 2,
                    UserId         = 100,
                    Name           = "TSLA",
                    TimeOfPurchase = DateTime.Now
                };

                var inv3 = new Investment()
                {
                    Id             = 3,
                    UserId         = 100,
                    Name           = "NKE",
                    TimeOfPurchase = DateTime.Now
                };

                var inv1Detail = new InvestmentDetail()
                {
                    SystemId          = 100,
                    InvestmentId      = 1,
                    Shares            = rand.Next(1, 20),
                    CostBasisPerShare = Math.Round(rand.NextDouble() * 500, 2),
                    CurrentPrice      = 0,
                    CurrentValue      = 0,
                    Term         = 0,
                    NetValuation = 0
                };

                var inv2Detail = new InvestmentDetail()
                {
                    SystemId          = 101,
                    InvestmentId      = 2,
                    Shares            = rand.Next(1, 20),
                    CostBasisPerShare = Math.Round(rand.NextDouble() * 500, 2),
                    CurrentPrice      = 0,
                    CurrentValue      = 0,
                    Term         = 0,
                    NetValuation = 0
                };

                var inv3Detail = new InvestmentDetail()
                {
                    SystemId          = 102,
                    InvestmentId      = 3,
                    Shares            = rand.Next(1, 20),
                    CostBasisPerShare = Math.Round(rand.NextDouble() * 500, 2),
                    CurrentPrice      = 0,
                    CurrentValue      = 0,
                    Term         = 1,
                    NetValuation = 0
                };

                inv1Detail.CurrentPrice = InvestmentCalculator.GeneratePrice(inv1Detail.CostBasisPerShare);
                inv1Detail.CurrentValue = InvestmentCalculator.DetermineValue(inv1Detail.Shares, inv1Detail.CurrentPrice);
                inv1Detail.NetValuation = InvestmentCalculator.DetermineNetValuation(inv1Detail.CurrentValue,
                                                                                     inv1Detail.Shares,
                                                                                     inv1Detail.CostBasisPerShare);

                inv2Detail.CurrentPrice = InvestmentCalculator.GeneratePrice(inv2Detail.CostBasisPerShare);
                inv2Detail.CurrentValue = InvestmentCalculator.DetermineValue(inv2Detail.Shares, inv2Detail.CurrentPrice);
                inv2Detail.NetValuation = InvestmentCalculator.DetermineNetValuation(inv2Detail.CurrentValue,
                                                                                     inv2Detail.Shares,
                                                                                     inv2Detail.CostBasisPerShare);

                inv3Detail.CurrentPrice = InvestmentCalculator.GeneratePrice(inv3Detail.CostBasisPerShare);
                inv3Detail.CurrentValue = InvestmentCalculator.DetermineValue(inv3Detail.Shares, inv3Detail.CurrentPrice);
                inv3Detail.NetValuation = InvestmentCalculator.DetermineNetValuation(inv3Detail.CurrentValue,
                                                                                     inv3Detail.Shares,
                                                                                     inv3Detail.CostBasisPerShare);

                context.Investments.Add(inv1);
                context.Investments.Add(inv2);
                context.Investments.Add(inv3);
                context.InvestmentDetails.Add(inv1Detail);
                context.InvestmentDetails.Add(inv2Detail);
                context.InvestmentDetails.Add(inv3Detail);
                context.SaveChanges();
            }
        }
예제 #10
0
 public InvestmentAccountRepository(InvestmentContext context)
 {
     this.dbContext = context;
 }
 public InvestmentDataService(InvestmentContext context)
 {
     _context = context;
 }
예제 #12
0
        public Microsoft.AspNetCore.Mvc.ActionResult Show()
        {
            InvestmentContext db = new InvestmentContext();

            return(View(db.¬ложени¤_к_обращению));
        }
 public SecurityRepository(InvestmentContext context)
 {
     this.dbContext = context;
 }