Пример #1
0
        public IEnumerable <ALeague.Models.Ladder> RMLadder_GetData()
        {
            var db = new Models.LadderEntities();

            // LINQ
            var results = (from si in db.Ladders
                           orderby si.clubID ascending,
                           si.position ascending,
                           si.clubName ascending,
                           si.matchesPlayed ascending,
                           si.win ascending, si.draw ascending,
                           si.lost ascending, si.goalsFor ascending,
                           si.goalsAgainst ascending, si.goalDifference ascending,
                           si.points ascending, si.thumbnail
                           select si).ToList();

            // Lambda
            // results = db.Ladders
            //      .OrderBy(si => si.clubID)
            //      .ThenBy(si => si.position)
            //      .ThenBy(si => si.clubName)
            //      .ThenBy(si => si.matchesPlayed)
            //      .ThenBy(si => si.win)
            //      .ThenBy(si => si.draw)
            //      .ThenBy(si => si.lost)
            //      .ThenBy(si => si.goalsFor)
            //      .ThenBy(si => si.goalsAgainst)
            //      .ThenBy(si => si.goalDifference)
            //      .ThenBy(si => si.points)
            //      .Select(si => si)
            //      .ToList();

            return(results);
        }
Пример #2
0
        // The id parameter should match the DataKeyNames value set on the control
        // or be decorated with a value provider attribute, e.g. [QueryString]int id
        public ResultDetail FVResult_GetItem([QueryString] int id)
        {
            var db     = new Models.LadderEntities();
            var result = (from r in db.Ladders
                          where r.clubID == id
                          select new ResultDetail
            {
                clubID = r.clubID,
                result = r
            }).FirstOrDefault();


            return(result);
        }