Beispiel #1
0
        public async Task <IActionResult> Top100(string str)
        {
            if (str == null)
            {
                return(NotFound());
            }
            else
            {
                Top100ViewModel top100ViewModel = new Top100ViewModel();

                List <PlayerModel> playerRanking = new List <PlayerModel>();
                List <Guild>       guildRanking  = new List <Guild>();

                if (str == "Knight" || str == "Archer" || str == "Mage")
                {
                    playerRanking = await _db.PlayerModel.Where(p => p.Class == str).OrderByDescending(m => m.Experience).Take(100).ToListAsync();
                }

                if (str == "Power")
                {
                    playerRanking = await _db.PlayerModel.OrderByDescending(m => m.TotalAttack).Take(100).ToListAsync();
                }

                if (str == "Gold")
                {
                    playerRanking = await _db.PlayerModel.OrderByDescending(m => m.Gold).Take(100).ToListAsync();
                }

                if (str == "Guild")
                {
                    guildRanking = await _db.Guild.OrderByDescending(p => p.GuildGold).Take(100).ToListAsync();
                }

                top100ViewModel.CrewRanking   = guildRanking;
                top100ViewModel.PlayerRanking = playerRanking;
                top100ViewModel.RankBy        = str;

                return(View(top100ViewModel));
            }
        }
 public Top100Page()
 {
     InitializeComponent();
     BindingContext = VM = new Top100ViewModel();
 }