Example #1
0
        /* Select group by count(*) from SGNotiInfo of CategoryId */
        public Dictionary <LSIDEBAR, int> SelectNotiInfoCategoryCount(int groupId)
        {
            Dictionary <LSIDEBAR, int> NotiDic;

            NotiDic = DBCtx.Notis
                      .Where(Noti => Noti.GroupId == groupId)
                      .GroupBy(Noti => Noti.CategoryId)
                      .Select(Noti => new
            {
                CategoryId    = Noti.Key,
                CategoryCount = Noti.Count()
            }
                              )
                      .OrderBy(Noti => Noti.CategoryId)
                      .ToDictionary(Noti => Noti.CategoryId, Noti => Noti.CategoryCount);
            return(NotiDic);
        }