Esempio n. 1
0
        public IActionResult Picks(int?id)
        {
            var picks = context.Pick.Where(p => p.PlayerId == id && p.Week == week).ToList();

            if (picks.Count() > 0)
            {
                var player = context.Players.FirstOrDefault(m => m.PlayerId == id);
                //ViewBag.status = "Not Found";
                var           tieBreaker = picks[0].TieBreaker;
                List <string> teamAbr    = new List <string>();

                foreach (var pick in picks)
                {
                    string abr = MatchupDataHelper.GetTeamAbr(pick.PlayerPick);
                    teamAbr.Add("/img/nfl-logo/" + abr + ".png");
                }

                ViewBag.player     = player;
                ViewBag.picks      = picks;
                ViewBag.abr        = teamAbr;
                ViewBag.tieBreaker = tieBreaker;

                return(View("Details", player));
            }
            else
            {
                var matchups = MatchupDataHelper.Load_Matchups(week);
                var player   = context.Players.FirstOrDefault(m => m.PlayerId == id);
                ViewBag.playerId = id;
                ViewBag.player   = player;
                return(View(matchups));
            }
        }
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var player = await _context.Players.FirstOrDefaultAsync(m => m.PlayerId == id);

            var           picks      = _context.Pick.Where(p => p.PlayerId == id && p.Week == week).ToList();
            var           tieBreaker = 0;
            List <string> teamAbr    = new List <string>();

            if (picks.Count > 0)
            {
                tieBreaker = picks[0].TieBreaker;
                foreach (var pick in player.Picks)
                {
                    string abr = MatchupDataHelper.GetTeamAbr(pick.PlayerPick);
                    teamAbr.Add("/img/nfl-logo/" + abr + ".png");
                }
            }


            if (player == null)
            {
                return(NotFound());
            }
            ViewBag.picks      = picks;
            ViewBag.abr        = teamAbr;
            ViewBag.tieBreaker = tieBreaker;

            return(View(player));
        }
Esempio n. 3
0
        public IActionResult Details(int?id)
        {
            var player     = context.Players.Where(p => p.PlayerId == id).FirstOrDefault();
            var picks      = context.Pick.Where(p => p.PlayerId == id && p.Week == week).ToList();
            var tieBreaker = picks[0].TieBreaker;

            List <string> teamAbr = new List <string>();

            if (picks.Count > 0)
            {
                foreach (var pick in player.Picks)
                {
                    string abr = MatchupDataHelper.GetTeamAbr(pick.PlayerPick);
                    teamAbr.Add("/img/nfl-logo/" + abr + ".png");
                }
            }

            ViewBag.picks      = picks;
            ViewBag.abr        = teamAbr;
            ViewBag.tieBreaker = tieBreaker;
            return(View(player));
        }