// GET: AccountController public async Task <ActionResult> Index() { var user = await _userManager.GetUserAsync(HttpContext.User); var userWithAccount = await _db.Users.Include(u => u.Account).ThenInclude(a => a.Characters).Where(u => u.Id.Equals(user.Id)).FirstOrDefaultAsync(); IndexModel model = new IndexModel(); model.PaymentHelper = _paymentHelper; if (_localDataHelper.CheckCharactersUpdateLimit(user)) { await _queryHelper.GetCharactersInfo(userWithAccount); user.LastAccountUpdateTime = DateTime.Now; _db.Attach(user); _db.Entry(user).Property(p => p.LastAccountUpdateTime).IsModified = true; await _db.SaveChangesAsync(); } if (await _localDataHelper.CheckOnlineUpdateLimit()) { await _queryHelper.GetOnlineCount(); var updates = await _db.DataUpdates.FirstAsync(); _db.Attach(updates); updates.LastOnlineUpdate = DateTime.Now; _db.Entry(updates).Property(p => p.LastOnlineUpdate).IsModified = true; await _db.SaveChangesAsync(); } if (await _localDataHelper.CheckStatsUpdateLimit()) { await _queryHelper.GetEpicOwners(); await _queryHelper.GetTopClans(); await _queryHelper.GetCastleInfo(); var updates = await _db.DataUpdates.FirstAsync(); _db.Attach(updates); updates.LastDataUpdate = DateTime.Now; _db.Entry(updates).Property(p => p.LastDataUpdate).IsModified = true; await _db.SaveChangesAsync(); } model.Characters = _localDataHelper.GetAccountInfo(userWithAccount); model.OnlinePlayers = await _localDataHelper.GetLastOnline(); model.EpicOwners = _localDataHelper.GetEpicOwners(); model.TopClans = _localDataHelper.GetTopClans(); model.CastleInfo = _localDataHelper.GetCastleInfo(); return(View(model)); }