Beispiel #1
0
        public List<PlayerHistoryVM> PlayerHistory(int peopleId)
        {
            using (var db = new CSBCDbContext())
            {

                var players = db.Players.Where(p => p.PeopleID == peopleId).OrderByDescending(p => p.Season.FromDate);
                var viewPlayers = new List<PlayerHistoryVM>();

                    foreach (var player in players)
                    {
                        var viewPlayer = new PlayerHistoryVM();
                        viewPlayer.SeasonID = (player.SeasonID == null ? 0 : (int) player.SeasonID);
                        if (player.Season != null)
                            viewPlayer.Season = player.Season.Description;
                        if (player.Team != null)
                            viewPlayer.Team = player.Team.TeamName;
                        viewPlayer.Rating = player.Rating;
                        viewPlayer.BalanceOwed = player.BalanceOwed;
                        viewPlayers.Add(viewPlayer);
                    }

                return viewPlayers;
            }
        }
Beispiel #2
0
 private void LoadPlayerHistory(int p)
 {
     using (var db = new CSBCDbContext())
     {
         var rep = new PlayerHistoryVM(db);
         var players = rep.PlayerHistory(p);
         //gridPlayerHistory.DataSource = players;
         //gridPlayerHistory.DataBind();
     }
 }