Ejemplo n.º 1
0
        public IQueryable <Users> GetTopUsers()
        {
            var UserRaitingArranged = from RaitingRecords in Db.UserRaiting
                                      group RaitingRecords by RaitingRecords.UserID
                                      into ResultTable
                                      select new { Key = ResultTable.Key, Raiting = ResultTable.Sum(value => value.Rating) };
            IQueryable <Users> TopUser = (from UserRecord in Db.Users
                                          join EachRecord in UserRaitingArranged on UserRecord.UserID equals EachRecord.Key
                                          orderby EachRecord.Raiting descending
                                          select UserRecord).Take(12);

            return(TopUser);
        }