Пример #1
0
        public ActionResult FindPlayer(string name)
        {
            JObject playerData = CsharpJamApi.GetSportSearchName(name);

            if (playerData.Count > 0)
            {
                List <UserPlayer> players = new List <UserPlayer>();

                foreach (JObject player in playerData["player"])
                {
                    players.Add(new UserPlayer(player));
                }
                return(View(players));
            }
            return(RedirectToAction("Search"));
        }
Пример #2
0
        public ActionResult FindPlayer(string name)
        {
            JObject playerData = CsharpJamApi.GetSportSearchName(name);

            if (playerData.Count > 0)
            {
                List <UserPlayer> players = new List <UserPlayer>();

                //Building the player from api data
                foreach (JObject player in playerData["player"])
                {
                    UserPlayer userPlayer = new UserPlayer(player);

                    //Exempted players with no data for eiither rating, height or weight
                    if (userPlayer.Rating > 0 || userPlayer.Height > 0 || userPlayer.Weight > 0)
                    {
                        players.Add(userPlayer);
                    }
                }
                return(View(players));
            }
            return(RedirectToAction("TeamManagement"));
        }