示例#1
0
        public IActionResult Details(int id)
        {
            var playerTeam = (from Player in _db.Players
                              .Where(p => p.Id == id)
                              join Team in _db.Teams on Player.TeamId equals Team.Id
                              select new { Player.Id, Player.PlayerName, Player.PlayerImageUrl, Player.Birthplace, Player.DoB,
                                           Team.TeamName, Team.TeamBadgeUrl })
                             .FirstOrDefault();
            var playerCountry = (from player in _db.Players
                                 .Where(p => p.Id == id)
                                 join Country in _db.Countries on player.CountryId equals Country.Id
                                 select new { Country.FlagUrl }).FirstOrDefault();
            var playerPosition = (from player in _db.Players
                                  .Where(p => p.Id == id)
                                  join Position in _db.Positions on player.PositionId equals Position.PositionId
                                  select new { Position.Position }).FirstOrDefault();


            var playerdet = new PlayerDetailModel();

            playerdet.Id             = playerTeam.Id;
            playerdet.PlayerName     = playerTeam.PlayerName;
            playerdet.PlayerImageUrl = playerTeam.PlayerImageUrl;
            playerdet.DoB            = playerTeam.DoB;
            playerdet.BirthPlace     = playerTeam.Birthplace;
            playerdet.TeamName       = playerTeam.TeamName;
            playerdet.TeamBadgeUrl   = playerTeam.TeamBadgeUrl;
            playerdet.FlagUrl        = playerCountry.FlagUrl;
            playerdet.Position       = playerPosition.Position;



            return(View(playerdet));
        }
示例#2
0
        private PlayerDetailModel GetDetailData(int Id)
        {
            var model = new PlayerDetailModel
            {
                Details = _detailPlayerQuery.Handle(new GetPlayerDetailsQuery()
                {
                    ID = Id
                })
            };

            return(model);
        }
示例#3
0
        public IActionResult PlayerDetail(int id)
        {
            var player = _playerService.GetById(id);
            var model  = new PlayerDetailModel()
            {
                PlayerId  = player.Id,
                FirstName = player.FirstName,
                LastName  = player.LastName,
                ImageUrl  = player.ImageUrl
            };

            return(View(model));
        }
示例#4
0
        public IActionResult SearchTwitter(int id)
        {
            var player = _playerService.GetById(id);
            var model  = new PlayerDetailModel()
            {
                PlayerId  = player.Id,
                FirstName = player.FirstName,
                LastName  = player.LastName,
                ImageUrl  = player.ImageUrl
            };

            model.RecentNews = new List <string> {
                "Twitter Info 1", "Twitter Info 2"
            };
            return(View("PlayerDetail", model));
        }