public List<GameRoomStatPDK> GetGameRoomStatPDKList(int pageIndex, int pageSize, out int totalCount)
{
using (AWEntites db = new AWEntites())
{
var query = from tb in db.GameOnLineUserPDK select tb;
var q = from p in query
group p by new
{
p.WID,
p.RoomName
}
into g
select new GameRoomStatPDK
{
WID=g.Key.WID??0,
RoomName = String.IsNullOrEmpty(g.Key.RoomName) ? "大厅" : g.Key.RoomName,
usersum = g.Count()
};
totalCount = query.Count();
q = q.OrderByDescending(a => a.usersum);
return q.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
}
}
linq lambda group count 创建新实体
最新推荐文章于 2024-08-29 13:58:23 发布