Ejemplo n.º 1
0
        public PlayerDetailsViewModel RetrievePlayer(int id)
        {
            var playerProcessor = new PlayerProcessor();
            var player          = new PlayerDetailsViewModel();

            player.player      = new Person();
            player.contract    = new Contract();
            player.healthCheck = new HealthCheckEvidention();

            try
            {
                var myPlayer = playerProcessor.RetrievePlayerDetails(id);
                player.player = playerProcessor.RetrievePlayer(myPlayer.Id);
                if (myPlayer.ContractId != 0 && myPlayer.ContractId != null)
                {
                    player.contract = playerProcessor.RetrieveContract(myPlayer.ContractId);
                }
                if (myPlayer.HealthCheckId != 0 && myPlayer.HealthCheckId != null)
                {
                    player.healthCheck = playerProcessor.RetrieveHealthCheck(myPlayer.HealthCheckId);
                }
            }

            catch (Exception e)
            {
                player = null;
            }

            return(player);
        }