public async Task <IActionResult> Index() { var model = new HomeViewModel { StockRates = await _ratesServices.GetStockRates() }; if (User.Identity.IsAuthenticated) { model.UserWallet = await _userWalletService.GetUserWallet(_userManager.GetUserId(User)); } return(View(model)); }
public async Task ContinuousTrading() { var actualCurses = await _ratesServices.GetStockRates(); var last = _context.ShereRateses.LastOrDefault(); if (actualCurses != null) { if (last?.DateTimeRates < actualCurses.PublicationDate || last == null) { var newCoureses = (from rate in actualCurses.Items select new ShareRates { Code = rate.Code, DateTimeRates = actualCurses.PublicationDate, Rate = rate.Price }).ToList(); _context.ShereRateses.AddRange(newCoureses); _context.SaveChanges(); } } }
public async Task <PartialViewResult> Index() { var rates = await _ratesServices.GetStockRates(); return(PartialView(rates)); }