コード例 #1
0
        public ActionResult Statistic()
        {
            List <Scorrer>        topscorrer  = new List <Scorrer>();
            MatchReportRepository mdetailsrep = new MatchReportRepository();
            var matchdet = mdetailsrep.GetAllMatchDetails();
            PlayerRepository playerrep = new PlayerRepository();
            var allplayers             = playerrep.GetAllPlayers();

            foreach (Player p in allplayers)
            {
                Scorrer scorrer = new Scorrer();
                scorrer.Id = p.ID;

                scorrer.Name     = p.LastName;
                scorrer.TeamName = p.Team.Name;
                scorrer.FName    = p.Name;
                scorrer.Picture  = p.Picture;

                int goals   = 0;
                var players = matchdet.Where(g => g.ID == p.ID);
                foreach (MatchDetails pl in players)
                {
                    if (pl.StatisticId == 7)
                    {
                        goals++;
                    }
                }
                scorrer.Goals = goals;
                topscorrer.Add(scorrer);
                ViewData["Scorrer"] = topscorrer.Where(g => g.Goals > 0).OrderByDescending(k => k.Goals);
            }
            return(View());
        }
コード例 #2
0
        public ActionResult View(int Id)
        {
            MatchReportRepository db = new MatchReportRepository();
            var report = db.GetAllMatchDetails().Where(k => k.MatchDetailsId == Id).FirstOrDefault();

            return(View(report));
        }
コード例 #3
0
        // GET: MatchDetails
        public ActionResult Index()
        {
            MatchReportRepository db = new MatchReportRepository();
            var matchdetails         = db.GetAllMatchDetails();

            ViewData["Reports"] = matchdetails;
            return(View());
        }
コード例 #4
0
        public ActionResult PlayerStatistic(int Id)
        {
            List <Scorrer>        topscorrer  = new List <Scorrer>();
            MatchReportRepository mdetailsrep = new MatchReportRepository();
            var matchdet = mdetailsrep.GetAllMatchDetails();
            PlayerRepository playerrep = new PlayerRepository();
            var allplayers             = playerrep.GetAllPlayers().Where(i => i.ID == Id);

            foreach (Player p in allplayers)
            {
                Scorrer scorrer = new Scorrer();
                scorrer.Id       = p.ID;
                scorrer.Name     = p.LastName;
                scorrer.TeamName = p.Team.Name;
                scorrer.FName    = p.Name;
                scorrer.Picture  = p.Picture;
                int yellowCard = 0;
                int redCard    = 0;
                int goals      = 0;

                var players = matchdet.Where(g => g.ID == p.ID);
                // var statplayer = players.Where(i => i.ID == Id);
                foreach (MatchDetails pl in players)
                {
                    if (pl.StatisticId == 7)
                    {
                        goals++;
                    }
                    if (pl.StatisticId == 8)
                    {
                        yellowCard++;
                    }
                    if (pl.StatisticId == 11)
                    {
                        redCard++;
                    }
                }
                scorrer.Goals      = goals;
                scorrer.YellowCard = yellowCard;
                scorrer.RedCard    = redCard;
                topscorrer.Add(scorrer);
                ViewData["PlayerStat"] = topscorrer.OrderByDescending(k => k.Goals);
            }
            return(View());
        }